本文整理汇总了TypeScript中@ember/object.setProperties函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setProperties函数的具体用法?TypeScript setProperties怎么用?TypeScript setProperties使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setProperties函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onChange
/**
* When user selects an item from the list
*/
onChange(selected: string): void {
if (selected && selected.trim().length > 0) {
setProperties(this, {
text: selected,
inputText: selected
});
this.onSearch(selected);
}
}
示例2: onFocus
/**
* When the input transitioned from blur->focus
* Restore inputText value from text, open suggestions, and search latest term
*/
onFocus(pws: IPowerSelectAPI<string>): void {
setProperties(this, {
inputText: this.text,
powerSelectApi: pws
});
if (this.text) {
pws.actions.search(this.text);
pws.actions.open();
}
}
示例3: async
const getBaseTest = async (test: ISearchBoxTestContext, override: ISearchBoxContract | {} = {}) => {
const props: ISearchBoxContract = {
placeholder: 'this is my placeholder',
text: undefined,
onTypeahead: async () => [],
onSearch: () => {},
...override
};
setProperties(test, props);
await render(hbs`
{{#search/search-box
placeholder=(readonly placeholder)
text=(readonly text)
onTypeahead=(action onTypeahead)
onSearch=(action onSearch) as |suggestion|}}
{{suggestion}}
{{/search/search-box}}
`);
return props;
};
示例4: run
let ret = run(function() {
return setProperties(context, hash);
});