当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript createWidget.default函数代码示例

本文整理汇总了TypeScript中src/createWidget.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createTabbedPanel

import createTabbedPanel from 'src/createTabbedPanel';
import createPanel from 'src/createPanel';
import createWidget from 'src/createWidget';
import projector from 'src/projector';

const tabbedPanel = createTabbedPanel();

const tab1 = createPanel({
	state: { label: 'tab 1', closeable: true }
});

tab1.append(createWidget({
	state: { label: JSON.stringify({ id: 'tab1' }) }
}));

tabbedPanel.append(tab1);

const tab2 = createPanel({
	state: { label: 'tab 2' }
});

tab2.append(createWidget({
	state: { label: JSON.stringify({ id: 'tab2' }) }
}));

tabbedPanel.append(tab2);

const tab3 = createPanel({
	state: { label: 'tab 3' }
});
开发者ID:danice,项目名称:widgets,代码行数:30,代码来源:tabbedPanel.ts

示例2: createWidget

import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import createWidget from 'src/createWidget';

registerSuite({
	name: 'createWidget',
	'basic'() {
		assert(createWidget);
		const widget = createWidget();
		assert(widget);
	},
	'destroy()'() {
		const widget = createWidget();
		return widget.destroy();
	},
	'getNodeAttributes()'() {
		const widget1 = createWidget({
			listeners: {
				'click'() {}
			},
			state: {
				id: 'foo'
			},
			tagName: 'h1'
		});

		const nodeAttributes1 = widget1.getNodeAttributes();
		assert.strictEqual(Object.keys(nodeAttributes1).length, 5, 'should have four keys only');
		assert.strictEqual(nodeAttributes1.id, 'foo');
		assert.isFunction(nodeAttributes1.onclick, 'onclick is a function');
		assert.deepEqual(nodeAttributes1.classes, {});
开发者ID:benpope82,项目名称:widgets,代码行数:31,代码来源:createWidget.ts

示例3: createTabbedPanel

		{ id: 'bar', label: 'Si at humo euismod fatua melior praesent praemitto camur foras eros. Esca multo transverbero facilisi nisl exputo nisl.' },
		{ id: 'panel-3', label: 'qat' },
		{ id: 'baz', label: 'Odio vel inhibeo nostrud. Ad duis blandit facilisi hos multo nobis quibus zelus bene. Ideo veniam eum iriure ymo.' },
		{ id: 'panel-4', label: 'baz', closeable: true },
		{ id: 'qat', label: 'Sit pertineo at facilisis quidne qui et amet duis. Patria meus proprius immitto ne appellatio cogo jus. Cui genitus sudo. Suscipit abdo dignissim huic accumsan importunus inhibeo luptatum ut neque augue sagaciter. Iaceo odio exerci natu nonummy vel iaceo odio erat.' }
	]
});

const widgets: Child[] = [];

/**
 * Header widget
 */
widgets.push(createWidget({
	id: 'title',
	stateFrom: widgetStore,
	tagName: 'h1'
}));

const tabbedPanel = createTabbedPanel({
	id: 'tabbed-panel',
	stateFrom: widgetStore
});

widgets.push(tabbedPanel);

const panel1 = createPanel({
	id: 'panel-1',
	stateFrom: widgetStore
});
开发者ID:danice,项目名称:widgets,代码行数:30,代码来源:index.ts


注:本文中的src/createWidget.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。