How to use the @aurelia/kernel.Tracer.enabled function in @aurelia/kernel

To help you get started, we’ve selected a few @aurelia/kernel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / runtime / src / templating / lifecycle-attach.ts View on Github external
flags |= LifecycleFlags.fromDetach;

    const hooks = this.$hooks;
    if (hooks & Hooks.hasDetaching) {
      this.detaching(flags);
    }

    // remove isAttached and isDetaching flags
    this.$state &= ~(State.isAttached | State.isDetaching);

    if (hooks & Hooks.hasDetached) {
      lifecycle.enqueueDetached(this);
    }
    lifecycle.endDetach(flags);
  }
  if (Tracer.enabled) { Tracer.leave(); }
}
github aurelia / aurelia / packages / runtime / src / observation / computed-observer.ts View on Github external
function createGetterTraps(flags: LifecycleFlags, observerLocator: IObserverLocator, observer: GetterObserver): ProxyHandler {
  if (Tracer.enabled) { Tracer.enter('computed', 'createGetterTraps', slice.call(arguments)); }
  const traps = {
    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);
github aurelia / aurelia / packages / testing / dist / esnext / tracing.js View on Github external
export function disableTracing() {
    Tracer.flushAll(null);
    Object.assign(Tracer, RuntimeTracer);
    Tracer.enabled = false;
}
export const SymbolTraceWriter = {
github aurelia / aurelia / packages / runtime / src / observation / property-accessor.ts View on Github external
constructor(obj: Record, propertyKey: string) {
    if (Tracer.enabled) { Tracer.enter('ArrayObserver.constructor', slice.call(arguments)); }
    this.obj = obj;
    this.propertyKey = propertyKey;
    if (Tracer.enabled) { Tracer.leave(); }
  }
github aurelia / aurelia / packages / runtime / src / observation / self-observer.ts View on Github external
this.currentValue = instance.$raw[propertyName];
      this.callback = callbackName in instance.$raw
        ? instance[callbackName].bind(instance)
        : noop;
    } else {
      this.obj = instance;
      this.propertyKey = propertyName;
      this.currentValue = instance[propertyName];
      this.callback = callbackName in instance
        ? instance[callbackName].bind(instance)
        : noop;
    }
    if (flags & LifecycleFlags.patchStrategy) {
      this.getValue = this.getValueDirect;
    }
    if (Tracer.enabled) { Tracer.leave(); }
  }
github aurelia / aurelia / packages / runtime / src / observation / array-observer.ts View on Github external
constructor(flags: LifecycleFlags, lifecycle: ILifecycle, array: IObservedArray) {
    if (Tracer.enabled) { Tracer.enter('ArrayObserver.constructor', slice.call(arguments)); }
    this.lifecycle = lifecycle;
    array.$observer = this;
    this.collection = array;
    this.flags = flags & LifecycleFlags.persistentBindingFlags;
    this.resetIndexMap();
    if (Tracer.enabled) { Tracer.leave(); }
  }
}
github aurelia / aurelia / packages / runtime / src / templating / lifecycle-render.ts View on Github external
const result = this.render(flags, host, options.parts!, parentContext);

    if (result && 'getElementTemplate' in result) {
      const template = result.getElementTemplate(renderingEngine, Type, parentContext);
      template.render(this, host, options.parts);
    }
  } else {
    const template = renderingEngine.getElementTemplate(dom, description, parentContext, Type);
    template.render(this, host, options.parts);
  }

  if (this.$hooks & Hooks.hasCreated) {
    bindingContext.created(flags);
  }
  if (Profiler.enabled) { leave(); }
  if (Tracer.enabled) { Tracer.leave(); }
}
github aurelia / aurelia / packages / runtime / src / observation / map-observer.ts View on Github external
constructor(flags: LifecycleFlags, lifecycle: ILifecycle, map: IObservedMap) {
    if (Tracer.enabled) { Tracer.enter('MapObserver', 'constructor', slice.call(arguments)); }

    if (!enableMapObservationCalled) {
      enableMapObservationCalled = true;
      enableMapObservation();
    }

    this.inBatch = false;

    this.collection = map;
    this.persistentFlags = flags & LifecycleFlags.persistentBindingFlags;
    this.indexMap = createIndexMap(map.size);
    this.lifecycle = lifecycle;
    this.lengthObserver = (void 0)!;

    map.$observer = this;
github aurelia / aurelia / packages / jit-html / dist / index.es6.js View on Github external
bind(node) {
        if (Tracer.enabled) {
            Tracer.enter('TemplateBinder', 'bind', slice.call(arguments));
        }
        if (Profiler.enabled) {
            enter();
        }
        const surrogateSave = this.surrogate;
        const parentManifestRootSave = this.parentManifestRoot;
        const manifestRootSave = this.manifestRoot;
        const manifestSave = this.manifest;
        const manifest = this.surrogate = this.manifest = new PlainElementSymbol(node);
        const attributes = node.attributes;
        let i = 0;
        while (i < attributes.length) {
            const attr = attributes[i];
            const attrSyntax = this.attrParser.parse(attr.name, attr.value);
            if (invalidSurrogateAttribute[attrSyntax.target] === true) {
github aurelia / aurelia / packages / runtime / src / observation / dirty-checker.ts View on Github external
constructor(dirtyChecker: IDirtyChecker, obj: IObservable, propertyKey: string) {
    if (Tracer.enabled) { Tracer.enter('DirtyCheckProperty', 'constructor', slice.call(arguments)); }
    this.obj = obj;
    this.propertyKey = propertyKey;

    this.dirtyChecker = dirtyChecker;
    if (Tracer.enabled) { Tracer.leave(); }
  }