當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Tracer.leave方法代碼示例

本文整理匯總了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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:28,代碼來源:let-binding.ts

示例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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:33,代碼來源:listener.ts

示例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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:30,代碼來源:attribute.ts

示例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(); }
}
開發者ID:aurelia,項目名稱:aurelia,代碼行數:30,代碼來源:lifecycle-bind.ts

示例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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:26,代碼來源:ref.ts

示例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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:60,代碼來源:template-binder.ts

示例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(); }
}
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:lifecycle-attach.ts

示例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);
    }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:35,代碼來源:computed-observer.ts

示例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(); }
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:56,代碼來源:attribute.ts

示例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;
  }
開發者ID:aurelia,項目名稱:aurelia,代碼行數:15,代碼來源:template-binder.ts


注:本文中的@aurelia/kernel.Tracer.leave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。