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