How to use the @aurelia/kernel.Reporter.write 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 / router / src / viewport.ts View on Github external
public async loadContent(): Promise {
    Reporter.write(10000, 'Viewport loadContent', this.name);

    // No need to wait for next component activation
    if (this.content.componentInstance && !(this.nextContent as ViewportContent).componentInstance) {
      await this.content.leave((this.nextContent as ViewportContent).instruction);
      await this.unloadContent();
    }

    if ((this.nextContent as ViewportContent).componentInstance) {
      if (this.content.componentInstance !== (this.nextContent as ViewportContent).componentInstance) {
        (this.nextContent as ViewportContent).addComponent(this.element as Element);
      } else {
        this.connectedScope.reenableReplacedChildren();
      }
      // Only when next component activation is done
      if (this.content.componentInstance) {
        await this.content.leave((this.nextContent as ViewportContent).instruction);
github aurelia / aurelia / packages / runtime / dist / esnext / binding / ast.js View on Github external
}
        if (hasBind(this.expression)) {
            this.expression.bind(flags, scope, binding);
        }
        const behaviorKey = this.behaviorKey;
        const behavior = locator.get(behaviorKey);
        if (!behavior) {
            throw Reporter.error(203 /* NoBehaviorFound */, this);
        }
        if (!(behavior instanceof BindingBehaviorFactory)) {
            if (binding[behaviorKey] === void 0) {
                binding[behaviorKey] = behavior;
                behavior.bind.call(behavior, flags, scope, binding, ...evalList(flags, scope, locator, this.args));
            }
            else {
                Reporter.write(204 /* BehaviorAlreadyApplied */, this);
            }
        }
    }
    unbind(flags, scope, binding) {
github aurelia / aurelia / packages / jit / dist / esnext / attribute-pattern.js View on Github external
function validatePrototype(handler, patternDefs) {
    for (const def of patternDefs) {
        // note: we're intentionally not throwing here
        if (!(def.pattern in handler)) {
            Reporter.write(401, def.pattern); // TODO: organize error codes
        }
        else if (typeof handler[def.pattern] !== 'function') {
            Reporter.write(402, def.pattern); // TODO: organize error codes
        }
    }
}
export const IAttributePattern = DI.createInterface('IAttributePattern').noDefault();
github aurelia / aurelia / packages / runtime / src / binding / ast.ts View on Github external
public unbind(flags: LifecycleFlags, scope: IScope, binding: IConnectableBinding): void {
    const behaviorKey = this.behaviorKey;
    if (binding[behaviorKey] !== undefined && binding[behaviorKey] !== null) {
      binding[behaviorKey].unbind(flags, scope, binding);
      binding[behaviorKey] = null;
    } else {
      // TODO: this is a temporary hack to make testing repeater keyed mode easier,
      // we should remove this idempotency again when track-by attribute is implemented
      Reporter.write(RuntimeError.BehaviorAlreadyApplied, this);
    }
    if (hasUnbind(this.expression)) {
      this.expression.unbind(flags, scope, binding);
    }
  }
github aurelia / aurelia / packages / runtime / dist / esnext / observation / setter-observer.js View on Github external
subscribe(subscriber) {
        if (this.observing === false) {
            this.observing = true;
            this.currentValue = this.obj[this.propertyKey];
            if (!Reflect.defineProperty(this.obj, this.propertyKey, {
                enumerable: true,
                configurable: true,
                get: () => {
                    return this.getValue();
                },
                set: value => {
                    this.setValue(value, 0 /* none */);
                },
            })) {
                Reporter.write(1, this.propertyKey, this.obj);
            }
        }
        this.addSubscriber(subscriber);
    }
};
github aurelia / aurelia / packages / runtime / src / observation / bindable-observer.ts View on Github external
if (
      !Reflect.defineProperty(
        this.obj,
        this.propertyKey,
        {
          enumerable: true,
          configurable: true,
          // todo: opt memory usage?
          get: () => this.getValue(),
          set: (value: unknown) => {
            this.setValue(value, LifecycleFlags.none);
          }
        }
      )
    ) {
      Reporter.write(1, this.propertyKey, this.obj);
    }
  }
}
github aurelia / aurelia / packages / store / src / store.ts View on Github external
private setupDevTools(): void {
    if (STORE.global.devToolsExtension) {
      Reporter.write(502);
      this.devToolsAvailable = true;
      this.devTools = STORE.global.__REDUX_DEVTOOLS_EXTENSION__.connect(this.options.devToolsOptions);
      this.devTools.init(this.initialState);

      this.devTools.subscribe((message: IStoreMessage) => {
        Reporter.write(503, message.type);

        if (message.type === 'DISPATCH') {
          this._state.next(JSON.parse(message.state));
        }
      });
    }
  }
github aurelia / aurelia / packages / runtime / src / observation / observer-locator.ts View on Github external
private createObserversLookup(obj: IObservable): Record {
    const value: Record = {};
    if (!Reflect.defineProperty(obj, '$observers', {
      enumerable: false,
      configurable: false,
      writable: false,
      value: value
    })) {
      Reporter.write(0, obj);
    }
    return value;
  }
github aurelia / aurelia / packages / router / dist / index.es6.js View on Github external
canEnter(viewport, previousInstruction) {
        if (!this.component) {
            return Promise.resolve(false);
        }
        if (!this.component.canEnter) {
            return Promise.resolve(true);
        }
        const merged = mergeParameters(this.parameters, this.instruction.query, this.content.parameters);
        this.instruction.parameters = merged.namedParameters;
        this.instruction.parameterList = merged.parameterList;
        const result = this.component.canEnter(merged.merged, this.instruction, previousInstruction);
        Reporter.write(10000, 'viewport canEnter', result);
        if (typeof result === 'boolean') {
            return Promise.resolve(result);
        }
        if (typeof result === 'string') {
            return Promise.resolve([new ViewportInstruction(result, viewport)]);
        }
        return result;
    }
    canLeave(nextInstruction) {
github aurelia / aurelia / packages / router / dist / esnext / navigator.js View on Github external
invokeCallback(entry, navigationFlags, previousEntry) {
        const instruction = { ...entry };
        instruction.navigation = navigationFlags;
        instruction.previous = this.toStoredEntry(previousEntry);
        Reporter.write(10000, 'callback', instruction, instruction.previous, this.entries);
        if (this.options.callback) {
            this.options.callback(instruction);
        }
    }
    toStoreableEntry(entry) {