本文整理汇总了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' }
});
示例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, {});
示例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
});