本文整理匯總了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;
}
示例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);
};
}
示例3: unregister
unregister(view: any) {
delete this._viewRegistry[getViewId(view)];
}