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


TypeScript Profiler.createTimer方法代碼示例

本文整理匯總了TypeScript中@aurelia/kernel.Profiler.createTimer方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Profiler.createTimer方法的具體用法?TypeScript Profiler.createTimer怎麽用?TypeScript Profiler.createTimer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@aurelia/kernel.Profiler的用法示例。


在下文中一共展示了Profiler.createTimer方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

import { DI, IContainer, IRegistry, PLATFORM, Profiler, Registration, Reporter } from '@aurelia/kernel';
import { IDOM, INode } from './dom';
import { BindingStrategy, LifecycleFlags } from './flags';
import { ProxyObserver } from './observation/proxy-observer';
import { ExposedContext } from './rendering-engine';
import { CustomElementResource, ICustomElement, ICustomElementType } from './resources/custom-element';

const { enter: enterStart, leave: leaveStart } = Profiler.createTimer('Aurelia.start');
const { enter: enterStop, leave: leaveStop } = Profiler.createTimer('Aurelia.stop');

export interface ISinglePageApp<THost extends INode = INode> {
  strategy?: BindingStrategy;
  dom?: IDOM;
  host: THost;
  component: unknown;
}

export class Aurelia {
  private readonly container: IContainer;
  private readonly components: ICustomElement[];
  private readonly startTasks: (() => void)[];
  private readonly stopTasks: (() => void)[];
  private isStarted: boolean;
  private _root: ICustomElement | null;

  constructor(container: IContainer = DI.createContainer()) {
    this.container = container;
    this.components = [];
    this.startTasks = [];
    this.stopTasks = [];
    this.isStarted = false;
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:aurelia.ts

示例2:

import { Profiler, Tracer, Writable } from '@aurelia/kernel';
import { Hooks, LifecycleFlags, State } from '../flags';
import { IComponent, ILifecycleHooks, IMountableComponent, IRenderable, IView } from '../lifecycle';
import { ICustomElement } from '../resources/custom-element';

interface IAttachable extends IRenderable, ILifecycleHooks, IComponent {
  constructor: {
    description?: { name: string };
    name: string;
  };
}

const slice = Array.prototype.slice;

const { enter, leave } = Profiler.createTimer('AttachLifecycle');

/** @internal */
// tslint:disable-next-line:no-ignored-initial-value
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;
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:lifecycle-attach.ts

示例3:

  IsLeftHandSide,
  IsPrimary,
  IsUnary,
  IsValueConverter,
  ObjectBindingPattern,
  ObjectLiteral,
  PrimitiveLiteral,
  TaggedTemplate,
  Template,
  Unary,
  UnaryOperator,
  ValueConverter
} from '@aurelia/runtime';
import { Access, Char, Precedence, Token, unescapeCode } from './common';

const { enter, leave } = Profiler.createTimer('ExpressionParser');

const $false = PrimitiveLiteral.$false;
const $true = PrimitiveLiteral.$true;
const $null = PrimitiveLiteral.$null;
const $undefined = PrimitiveLiteral.$undefined;
const $this = AccessThis.$this;
const $parent = AccessThis.$parent;

/** @internal */
export class ParserState {
  public index: number;
  public startIndex: number;
  public input: string;
  public lastIndex: number;
  public length: number;
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:expression-parser.ts

示例4: register

import {
  DefaultBindingLanguage as JitDefaultBindingLanguage,
  DefaultBindingSyntax as JitDefaultBindingSyntax,
  DefaultComponents as JitDefaultComponents
} from '@aurelia/jit';
import {
  DefaultBindingLanguage as JitHtmlDefaultBindingLanguage,
  DefaultComponents as JitHtmlDefaultComponents
} from '@aurelia/jit-html';
import { DI, IContainer, Profiler } from '@aurelia/kernel';
import { BasicConfiguration as RuntimeHtmlBrowserBasicConfiguration } from '@aurelia/runtime-html-browser';

const { enter, leave } = Profiler.createTimer('BasicConfiguration');

/**
 * A DI configuration object containing html-specific, browser-specific registrations:
 * - `BasicConfiguration` from `@aurelia/runtime-html-browser`
 * - `DefaultComponents` from `@aurelia/jit`
 * - `DefaultBindingSyntax` from `@aurelia/jit`
 * - `DefaultBindingLanguage` from `@aurelia/jit`
 * - `DefaultComponents` from `@aurelia/jit-html`
 * - `DefaultBindingLanguage` from `@aurelia/jit-html`
 */
export const BasicConfiguration = {
  /**
   * Apply this configuration to the provided container.
   */
  register(container: IContainer): IContainer {
    if (Profiler.enabled) { enter(); }
    RuntimeHtmlBrowserBasicConfiguration
      .register(container)
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:index.ts

示例5:

import { Profiler, Tracer, Writable } from '@aurelia/kernel';
import { Hooks, LifecycleFlags, State } from '../flags';
import { IComponent, ILifecycleHooks, IRenderable } from '../lifecycle';
import { IPatchable, IScope } from '../observation';
import { patchProperties } from '../observation/patch-properties';

const slice = Array.prototype.slice;

const { enter, leave } = Profiler.createTimer('BindLifecycle');

interface IBindable extends IRenderable, ILifecycleHooks, IComponent {
  constructor: {
    description?: { name: string };
    name: string;
  };
}

/** @internal */
export function $bindAttribute(this: Writable<IBindable>, flags: LifecycleFlags, scope: IScope): void {
  if (Profiler.enabled) { enter(); }
  if (Tracer.enabled) { Tracer.enter(this.constructor.description && this.constructor.description.name || this.constructor.name, '$bind', slice.call(arguments)); }
  flags |= LifecycleFlags.fromBind;

  if (this.$state & State.isBound) {
    if (this.$scope === scope) {
      if (Profiler.enabled) { leave(); }
      if (Tracer.enabled) { Tracer.leave(); }
      return;
    }

    this.$unbind(flags);
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:lifecycle-bind.ts

示例6:

  SymbolFlags,
  TemplateControllerSymbol,
  TextSymbol
} from '@aurelia/jit';
import { PLATFORM, Profiler, Tracer } from '@aurelia/kernel';
import {
  BindingMode,
  BindingType,
  IDOM,
  IExpressionParser
} from '@aurelia/runtime';
import { NodeType } from '@aurelia/runtime-html';

const slice = Array.prototype.slice;

const { enter, leave } = Profiler.createTimer('TemplateBinder');

const invalidSurrogateAttribute = {
  'id': true,
  'part': true,
  'replace-part': true
};

const attributesToIgnore = {
  'as-element': true,
  'part': true,
  'replace-part': true
};

/**
 * TemplateBinder. Todo: describe goal of this class
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:template-binder.ts

示例7: getElementTemplate

import { IServiceLocator, PLATFORM, Profiler, Tracer, Writable } from '@aurelia/kernel';
import { IElementHydrationOptions, TemplateDefinition } from '../definitions';
import { IDOM, INode } from '../dom';
import { Hooks, LifecycleFlags } from '../flags';
import { Scope } from '../observation/binding-context';
import { ProxyObserver } from '../observation/proxy-observer';
import { IRenderingEngine, ITemplate } from '../rendering-engine';
import { ICustomAttribute, ICustomAttributeType } from '../resources/custom-attribute';
import { ICustomElement, ICustomElementType, IProjectorLocator } from '../resources/custom-element';

const slice = Array.prototype.slice;

const { enter, leave } = Profiler.createTimer('RenderLifecycle');

export interface IElementTemplateProvider {
  getElementTemplate(renderingEngine: IRenderingEngine, customElementType: ICustomElementType | null, parentContext: IServiceLocator): ITemplate;
}

export interface ILifecycleRender {
  /**
   * Only applies to `@customElement`. This hook is not invoked for `@customAttribute`s
   *
   * Called during `$hydrate`, after `this.$scope` and `this.$projector` are set.
   *
   * If this hook is implemented, it will be used instead of `renderingEngine.getElementTemplate`.
   * This allows you to completely override the default rendering behavior.
   *
   * It is the responsibility of the implementer to:
   * - Populate `this.$bindables` with any Bindings, child Views, custom elements and custom attributes
   * - Populate `this.$attachables` with any child Views, custom elements and custom attributes
   * - Populate `this.$nodes` with the nodes that need to be appended to the host
開發者ID:aurelia,項目名稱:aurelia,代碼行數:31,代碼來源:lifecycle-render.ts


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