本文整理汇总了TypeScript中@glimmer/reference.CURRENT_TAG类的典型用法代码示例。如果您正苦于以下问题:TypeScript CURRENT_TAG类的具体用法?TypeScript CURRENT_TAG怎么用?TypeScript CURRENT_TAG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CURRENT_TAG类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: _renderRoots
_renderRoots() {
let { _roots: roots, _env: env, _removedRoots: removedRoots } = this;
let globalShouldReflush = false;
let initialRootsLength: number;
do {
env.begin();
try {
// ensure that for the first iteration of the loop
// each root is processed
initialRootsLength = roots.length;
globalShouldReflush = false;
for (let i = 0; i < roots.length; i++) {
let root = roots[i];
if (root.destroyed) {
// add to the list of roots to be removed
// they will be removed from `this._roots` later
removedRoots.push(root);
// skip over roots that have been marked as destroyed
continue;
}
let { shouldReflush } = root;
// when processing non-initial reflush loops,
// do not process more roots than needed
if (i >= initialRootsLength && !shouldReflush) {
continue;
}
root.options.alwaysRevalidate = shouldReflush;
// track shouldReflush based on this roots render result
shouldReflush = root.shouldReflush = runInTransaction(root, 'render');
// globalShouldReflush should be `true` if *any* of
// the roots need to reflush
globalShouldReflush = globalShouldReflush || shouldReflush;
}
this._lastRevision = CURRENT_TAG.value();
} finally {
env.commit();
}
} while (globalShouldReflush || roots.length > initialRootsLength);
// remove any roots that were destroyed during this transaction
while (removedRoots.length) {
let root = removedRoots.pop();
let rootIndex = roots.indexOf(root!);
roots.splice(rootIndex, 1);
}
if (this._roots.length === 0) {
deregister(this);
}
}
开发者ID:habdelra,项目名称:ember.js,代码行数:60,代码来源:renderer.ts
示例2: _renderRootsTransaction
_renderRootsTransaction() {
if (this._isRenderingRoots) {
// currently rendering roots, a new root was added and will
// be processed by the existing _renderRoots invocation
return;
}
// used to prevent calling _renderRoots again (see above)
// while we are actively rendering roots
this._isRenderingRoots = true;
let completedWithoutError = false;
try {
this._renderRoots();
completedWithoutError = true;
} finally {
if (!completedWithoutError) {
this._lastRevision = CURRENT_TAG.value();
if (this._env.inTransaction === true) {
this._env.commit();
}
}
this._isRenderingRoots = false;
}
}
开发者ID:habdelra,项目名称:ember.js,代码行数:25,代码来源:renderer.ts
示例3: flushInvalidActiveObservers
export function flushInvalidActiveObservers(shouldSchedule = true) {
if (lastKnownRevision === CURRENT_TAG.value()) {
return;
}
lastKnownRevision = CURRENT_TAG.value();
ACTIVE_OBSERVERS.forEach((activeObservers, target) => {
let meta = peekMeta(target);
if (meta && (meta.isSourceDestroying() || meta.isMetaDestroyed())) {
ACTIVE_OBSERVERS.delete(target);
return;
}
activeObservers.forEach((observer, eventName) => {
if (!observer.tag.validate(observer.lastRevision)) {
let sendObserver = () => {
try {
sendEvent(target, eventName, [target, observer.path]);
} finally {
observer.tag = getChainTagsForKey(target, observer.path);
observer.lastRevision = observer.tag.value();
}
};
if (shouldSchedule) {
schedule('actions', sendObserver);
} else {
// TODO: we need to schedule eagerly in exactly one location (_internalReset),
// for query params. We should get rid of this ASAP
sendObserver();
}
}
});
});
}
开发者ID:emberjs,项目名称:ember.js,代码行数:37,代码来源:observer.ts
示例4: _isValid
_isValid() {
return this._destroyed || this._roots.length === 0 || CURRENT_TAG.validate(this._lastRevision);
}
开发者ID:habdelra,项目名称:ember.js,代码行数:3,代码来源:renderer.ts
注:本文中的@glimmer/reference.CURRENT_TAG类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论