本文整理匯總了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);
});