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


TypeScript views.getViewId函數代碼示例

本文整理匯總了TypeScript中@ember/-internals/views.getViewId函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getViewId函數的具體用法?TypeScript getViewId怎麽用?TypeScript getViewId使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: register

 register(view: any) {
   let id = getViewId(view);
   assert(
     'Attempted to register a view with an id already in use: ' + id,
     !this._viewRegistry[id]
   );
   this._viewRegistry[id] = view;
 }
開發者ID:habdelra,項目名稱:ember.js,代碼行數:8,代碼來源:renderer.ts

示例2: constructor

  constructor(
    root: Component | OutletView,
    env: Environment,
    template: OwnedTemplate,
    self: VersionedPathReference<Opaque>,
    parentElement: Simple.Element,
    dynamicScope: DynamicScope,
    builder: IBuilder
  ) {
    assert(`You cannot render \`${self.value()}\` without a template.`, template !== undefined);

    this.id = getViewId(root);
    this.env = env;
    this.root = root;
    this.result = undefined;
    this.shouldReflush = false;
    this.destroyed = false;

    let options = (this.options = {
      alwaysRevalidate: false,
    });

    this.render = () => {
      let layout = template.asLayout();
      let handle = layout.compile();
      let iterator = renderMain(
        layout['compiler'].program,
        env,
        self,
        dynamicScope,
        builder(env, { element: parentElement, nextSibling: null }),
        handle
      );
      let iteratorResult: IteratorResult<RenderResult>;
      do {
        iteratorResult = iterator.next();
      } while (!iteratorResult.done);

      let result = (this.result = iteratorResult.value);

      // override .render function after initial render
      this.render = () => result.rerender(options);
    };
  }
開發者ID:habdelra,項目名稱:ember.js,代碼行數:44,代碼來源:renderer.ts

示例3: unregister

 unregister(view: any) {
   delete this._viewRegistry[getViewId(view)];
 }
開發者ID:habdelra,項目名稱:ember.js,代碼行數:3,代碼來源:renderer.ts


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