本文整理匯總了TypeScript中@dojo/core/lang.assign函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript assign函數的具體用法?TypeScript assign怎麽用?TypeScript assign使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了assign函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: render
render(): DNode {
const {
forId,
label
} = this.properties;
// assign string or object label properites with defaults
let labelProps: LabelOptions;
if (typeof label === 'string') {
labelProps = assign({}, labelDefaults, { content: label });
}
else {
labelProps = assign({}, labelDefaults, label);
}
// add label text node to children
const labelText = v('span', {
innerHTML: labelProps.content,
classes: [ this.theme(css.labelText), labelProps.hidden ? baseCss.visuallyHidden : null ]
});
if (labelProps.before) {
this.children.unshift(labelText);
}
else {
this.children.push(labelText);
}
return v('label', {
classes: this.theme(css.root),
for: forId
}, this.children);
}
示例2: function
const props = function(props = {}) {
return assign({
controls: 'foo',
id: 'foo',
index: 0
}, props);
};
示例3: function
export const todoSave = function(this: any, event: FormInputEvent) {
const { properties } = this;
if (!event.target.value) {
deleteTodo(properties);
}
else {
updateTodo(assign({}, properties, { label: event.target.value, editing: false }));
}
};
示例4: function
export const todoSave = function (this: any, event: FormInputEvent) {
const { state } = this;
if (!event.target.value) {
deleteTodo(state);
}
else {
updateTodo(assign(state, { label: event.target.value, editing: false }));
}
};
示例5: assign
return this.children.filter((child) => child).map(child => {
// null checks skipped since children are filtered prior to mapping
assign(child!.properties, {
onRequestClose: this._assignCallback(child!, 'onRequestClose', this.onRequestClose),
onRequestOpen: this._assignCallback(child!, 'onRequestOpen', this.onRequestOpen),
open: includes(openKeys, child!.properties.key),
theme
});
return child;
});
示例6: missingFile
function missingFile(path: string) {
return assign(
new Error(
`Error: ENOENT: no such file or directory stat '${path}' errno -2`
),
{
code: 'ENOENT',
errno: -2,
syscall: 'stat',
path
}
);
}