本文整理匯總了TypeScript中glimmer-object-reference.UpdatableReference.update方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript UpdatableReference.update方法的具體用法?TypeScript UpdatableReference.update怎麽用?TypeScript UpdatableReference.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類glimmer-object-reference.UpdatableReference
的用法示例。
在下文中一共展示了UpdatableReference.update方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test("changing dynamic scope", assert => {
let template = compile("{{view.name}} {{#with-keywords view=innerView}}{{view.name}}{{/with-keywords}} {{view.name}}");
let view = { name: 'Godfrey' };
let viewRef = new UpdatableReference(view);
let innerView = { name: 'Yehuda' };
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");
self.update({ innerView: { name: 'Yehuda' } });
viewRef.update({ name: 'Godfrey' });
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();
}