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