本文整理汇总了TypeScript中@aurelia/kernel.Tracer.leave方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Tracer.leave方法的具体用法?TypeScript Tracer.leave怎么用?TypeScript Tracer.leave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@aurelia/kernel.Tracer
的用法示例。
在下文中一共展示了Tracer.leave方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
public $bind(flags: LifecycleFlags, scope: IScope): void {
if (Tracer.enabled) { Tracer.enter('LetBinding', '$bind', slice.call(arguments)); }
if (this.$state & State.isBound) {
if (this.$scope === scope) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
this.$unbind(flags | LifecycleFlags.fromBind);
}
// add isBinding flag
this.$state |= State.isBinding;
this.$scope = scope;
this.target = (this.toViewModel ? scope.bindingContext : scope.overrideContext) as IIndexable;
const sourceExpression = this.sourceExpression;
if (sourceExpression.bind) {
sourceExpression.bind(flags, scope, this);
}
// sourceExpression might have been changed during bind
this.target[this.targetProperty] = this.sourceExpression.evaluate(LifecycleFlags.fromBind, scope, this.locator);
this.sourceExpression.connect(flags, scope, this);
// add isBound flag and remove isBinding flag
this.$state |= State.isBound;
this.$state &= ~State.isBinding;
if (Tracer.enabled) { Tracer.leave(); }
}
示例2:
public $bind(flags: LifecycleFlags, scope: IScope): void {
if (Tracer.enabled) { Tracer.enter('Listener', '$bind', slice.call(arguments)); }
if (this.$state & State.isBound) {
if (this.$scope === scope) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
this.$unbind(flags | LifecycleFlags.fromBind);
}
// add isBinding flag
this.$state |= State.isBinding;
this.$scope = scope;
const sourceExpression = this.sourceExpression;
if (hasBind(sourceExpression)) {
sourceExpression.bind(flags, scope, this);
}
this.handler = this.eventManager.addEventListener(
this.dom,
this.target,
this.targetEvent,
this,
this.delegationStrategy
);
// add isBound flag and remove isBinding flag
this.$state |= State.isBound;
this.$state &= ~State.isBinding;
if (Tracer.enabled) { Tracer.leave(); }
}
示例3:
public $unbind(flags: LifecycleFlags): void {
if (Tracer.enabled) { Tracer.enter('Binding', '$unbind', slice.call(arguments)); }
if (!(this.$state & State.isBound)) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// add isUnbinding flag
this.$state |= State.isUnbinding;
// clear persistent flags
this.persistentFlags = LifecycleFlags.none;
if (hasUnbind(this.sourceExpression)) {
this.sourceExpression.unbind(flags, this.$scope, this);
}
this.$scope = null;
if ((this.targetObserver as IBindingTargetObserver).unbind) {
(this.targetObserver as IBindingTargetObserver).unbind(flags);
}
if ((this.targetObserver as IBindingTargetObserver).unsubscribe) {
(this.targetObserver as IBindingTargetObserver).unsubscribe(this);
this.targetObserver[this.id] &= ~LifecycleFlags.updateSourceExpression;
}
this.unobserve(true);
// remove isBound and isUnbinding flags
this.$state &= ~(State.isBound | State.isUnbinding);
if (Tracer.enabled) { Tracer.leave(); }
}
示例4: while
export function $lockedBind(this: IBindable, flags: LifecycleFlags): void {
if (Tracer.enabled) { Tracer.enter('IView', 'lockedBind', slice.call(arguments)); }
flags |= LifecycleFlags.fromBind;
if (this.$state & State.isBound) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// add isBinding flag
this.$state |= State.isBinding;
const scope = this.$scope;
let binding = this.$bindingHead;
while (binding !== null) {
binding.$bind(flags, scope);
binding = binding.$nextBinding;
}
let component = this.$componentHead;
while (component !== null) {
component.$bind(flags, scope);
component = component.$nextComponent;
}
// add isBound flag and remove isBinding flag
this.$state |= State.isBound;
this.$state &= ~State.isBinding;
if (Tracer.enabled) { Tracer.leave(); }
}
示例5:
public $bind(flags: LifecycleFlags, scope: IScope): void {
if (Tracer.enabled) { Tracer.enter('Ref', '$bind', slice.call(arguments)); }
if (this.$state & State.isBound) {
if (this.$scope === scope) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
this.$unbind(flags | LifecycleFlags.fromBind);
}
// add isBinding flag
this.$state |= State.isBinding;
this.$scope = scope;
if (hasBind(this.sourceExpression)) {
this.sourceExpression.bind(flags, scope, this);
}
this.sourceExpression.assign(flags, this.$scope, this.locator, this.target);
// add isBound flag and remove isBinding flag
this.$state |= State.isBound;
this.$state &= ~State.isBinding;
if (Tracer.enabled) { Tracer.leave(); }
}
示例6: bindManifest
private bindManifest(parentManifest: IElementSymbol, node: HTMLTemplateElement | HTMLElement): void {
if (Tracer.enabled) { Tracer.enter('TemplateBinder', 'bindManifest', slice.call(arguments)); }
switch (node.nodeName) {
case 'LET':
// let cannot have children and has some different processing rules, so return early
this.bindLetElement(parentManifest, node);
if (Tracer.enabled) { Tracer.leave(); }
return;
case 'SLOT':
// slot requires no compilation
this.surrogate.hasSlots = true;
if (Tracer.enabled) { Tracer.leave(); }
return;
}
// nodes are processed bottom-up so we need to store the manifests before traversing down and
// restore them again afterwards
const parentManifestRootSave = this.parentManifestRoot;
const manifestRootSave = this.manifestRoot;
const manifestSave = this.manifest;
// get the part name to override the name of the compiled definition
this.partName = node.getAttribute('part');
let manifestRoot: CustomElementSymbol;
let name = node.getAttribute('as-element');
if (name === null) {
name = node.nodeName.toLowerCase();
}
const elementInfo = this.resources.getElementInfo(name);
if (elementInfo === null) {
// there is no registered custom element with this name
this.manifest = new PlainElementSymbol(node);
} else {
// it's a custom element so we set the manifestRoot as well (for storing replace-parts)
this.parentManifestRoot = this.manifestRoot;
manifestRoot = this.manifestRoot = this.manifest = new CustomElementSymbol(this.dom, node, elementInfo);
}
// lifting operations done by template controllers and replace-parts effectively unlink the nodes, so start at the bottom
this.bindChildNodes(node);
// the parentManifest will receive either the direct child nodes, or the template controllers / replace-parts
// wrapping them
this.bindAttributes(node, parentManifest);
if (manifestRoot !== undefined && manifestRoot.isContainerless) {
node.parentNode.replaceChild(manifestRoot.marker as Node, node);
} else if (this.manifest.isTarget) {
node.classList.add('au');
}
// restore the stored manifests so the attributes are processed on the correct lavel
this.parentManifestRoot = parentManifestRootSave;
this.manifestRoot = manifestRootSave;
this.manifest = manifestSave;
if (Tracer.enabled) { Tracer.leave(); }
}
示例7:
export function $attachAttribute(this: Writable<IAttachable>, flags: LifecycleFlags): void {
if (Profiler.enabled) { enter(); }
if (Tracer.enabled) { Tracer.enter(this.constructor.description && this.constructor.description.name || this.constructor.name, '$attach', slice.call(arguments)); }
if (this.$state & State.isAttached) {
if (Profiler.enabled) { leave(); }
if (Tracer.enabled) { Tracer.leave(); }
return;
}
const lifecycle = this.$lifecycle;
lifecycle.beginAttach();
// add isAttaching flag
this.$state |= State.isAttaching;
flags |= LifecycleFlags.fromAttach;
const hooks = this.$hooks;
if (hooks & Hooks.hasAttaching) {
this.attaching(flags);
}
// add isAttached flag, remove isAttaching flag
this.$state |= State.isAttached;
this.$state &= ~State.isAttaching;
if (hooks & Hooks.hasAttached) {
lifecycle.enqueueAttached(this as Required<typeof this>);
}
lifecycle.endAttach(flags);
if (Profiler.enabled) { leave(); }
if (Tracer.enabled) { Tracer.leave(); }
}
示例8: function
get: function(target: object, key: PropertyKey, receiver?: unknown): unknown {
if (Tracer.enabled) { Tracer.enter('computed', 'get', slice.call(arguments)); }
if (observer.doNotCollect(key)) {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, receiver);
}
// The length and iterator properties need to be invoked on the original object (for Map and Set
// at least) or they will throw.
switch (toStringTag.call(target)) {
case '[object Array]':
observer.addCollectionDep(observerLocator.getArrayObserver(flags, target as unknown[]));
if (key === 'length') {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, target);
}
case '[object Map]':
observer.addCollectionDep(observerLocator.getMapObserver(flags, target as Map<unknown, unknown>));
if (key === 'size') {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, target);
}
case '[object Set]':
observer.addCollectionDep(observerLocator.getSetObserver(flags, target as Set<unknown>));
if (key === 'size') {
if (Tracer.enabled) { Tracer.leave(); }
return Reflect.get(target, key, target);
}
default:
observer.addPropertyDep(observerLocator.getObserver(flags, target, key as string) as IBindingTargetObserver);
}
if (Tracer.enabled) { Tracer.leave(); }
return proxyOrValue(flags, target, key, observerLocator, observer);
}
示例9: AttributeObserver
public $bind(flags: LifecycleFlags, scope: IScope): void {
if (Tracer.enabled) { Tracer.enter('Binding', '$bind', slice.call(arguments)); }
if (this.$state & State.isBound) {
if (this.$scope === scope) {
if (Tracer.enabled) { Tracer.leave(); }
return;
}
this.$unbind(flags | LifecycleFlags.fromBind);
}
// add isBinding flag
this.$state |= State.isBinding;
// Store flags which we can only receive during $bind and need to pass on
// to the AST during evaluate/connect/assign
this.persistentFlags = flags & LifecycleFlags.persistentBindingFlags;
this.$scope = scope;
let sourceExpression = this.sourceExpression;
if (hasBind(sourceExpression)) {
sourceExpression.bind(flags, scope, this);
}
let targetObserver = this.targetObserver as IBindingTargetObserver;
if (!targetObserver) {
targetObserver = this.targetObserver = new AttributeObserver(
LifecycleFlags.fromBind,
this.$lifecycle,
this.observerLocator,
this.target,
this.targetAttribute,
this.targetProperty
);
}
if (targetObserver.bind) {
targetObserver.bind(flags);
}
// during bind, binding behavior might have changed sourceExpression
sourceExpression = this.sourceExpression;
if (this.mode & toViewOrOneTime) {
this.updateTarget(sourceExpression.evaluate(flags, scope, this.locator), flags);
}
if (this.mode & toView) {
sourceExpression.connect(flags, scope, this);
}
if (this.mode & fromView) {
targetObserver[this.id] |= LifecycleFlags.updateSourceExpression;
targetObserver.subscribe(this);
}
// add isBound flag and remove isBinding flag
this.$state |= State.isBound;
this.$state &= ~State.isBinding;
if (Tracer.enabled) { Tracer.leave(); }
}
示例10: declareReplacePart
private declareReplacePart(node: HTMLTemplateElement | HTMLElement): ReplacePartSymbol {
if (Tracer.enabled) { Tracer.enter('TemplateBinder', 'declareReplacePart', slice.call(arguments)); }
const name = node.getAttribute('replace-part');
if (name === null) {
if (Tracer.enabled) { Tracer.leave(); }
return null;
}
node.removeAttribute('replace-part');
const symbol = new ReplacePartSymbol(name);
if (Tracer.enabled) { Tracer.leave(); }
return symbol;
}