當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lang.assign函數代碼示例

本文整理匯總了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);
	}
開發者ID:bitpshr,項目名稱:widgets,代碼行數:32,代碼來源:Label.ts

示例2: function

const props = function(props = {}) {
	return assign({
		controls: 'foo',
		id: 'foo',
		index: 0
	}, props);
};
開發者ID:dylans,項目名稱:widgets,代碼行數:7,代碼來源:TabButton.ts

示例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 }));
	}
};
開發者ID:Tomdye,項目名稱:examples,代碼行數:9,代碼來源:userActions.ts

示例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 }));
	}
};
開發者ID:Tomdye,項目名稱:examples,代碼行數:9,代碼來源:userActions.ts

示例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;
		});
開發者ID:dylans,項目名稱:widgets,代碼行數:11,代碼來源:AccordionPane.ts

示例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
			}
		);
	}
開發者ID:devpaul,項目名稱:intern,代碼行數:13,代碼來源:nodeMocks.ts


注:本文中的@dojo/core/lang.assign函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。