本文整理匯總了TypeScript中glimmer-object-reference.UpdatableReference類的典型用法代碼示例。如果您正苦於以下問題:TypeScript UpdatableReference類的具體用法?TypeScript UpdatableReference怎麽用?TypeScript UpdatableReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了UpdatableReference類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test("changing dynamic scope derived from another keyword from the outer scope", assert => {
let template = compile("{{view.name}} {{#with-keywords view=view.innerView}}{{view.name}}{{/with-keywords}} {{view.name}}");
let innerView = { name: 'Yehuda' };
let view = { name: 'Godfrey', innerView };
let viewRef = new UpdatableReference(view);
render(template, { innerView }, viewRef);
equalTokens(root, 'Godfrey Yehuda Godfrey', "Initial render");
rerender();
equalTokens(root, 'Godfrey Yehuda Godfrey', "Noop rerender");
innerView.name = 'Tom';
rerender();
equalTokens(root, 'Godfrey Tom Godfrey', "Update with mutation");
view.name = 'Godhuda';
rerender();
equalTokens(root, 'Godhuda Tom Godhuda', "Update with mutation");
viewRef.update({ name: 'Godfrey', innerView: { name: 'Yehuda' } });
rerender();
equalTokens(root, 'Godfrey Yehuda Godfrey', "Reset with replacement");
});
示例2: rerender
function rerender(context: Object = {}, params: RerenderParams = { assertStable: false }) {
let snapshot;
if (params.assertStable) {
snapshot = generateSnapshot(root);
}
self.update(opaque(context));
result.rerender();
if (params.assertStable) {
equalSnapshots(generateSnapshot(root), snapshot);
}
}
示例3: rerender
function rerender(context: any = null) {
if (context !== null) self.update(context);
env.begin();
result.rerender();
env.commit();
}
示例4: rerender
function rerender(context: any = null) {
if (context !== null) self.update(context);
result.rerender();
}
示例5: rerender
function rerender(context: Object={}) {
self.update(opaque(context));
env.begin();
result.rerender();
env.commit();
}
示例6: rerender
function rerender(context: Object={}) {
self.update(opaque(context));
result.rerender();
}