本文整理汇总了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();
}