本文整理匯總了TypeScript中@phosphor/signaling.Signal類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Signal類的具體用法?TypeScript Signal怎麽用?TypeScript Signal使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Signal類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should resolve to the given value', async () => {
const owner = {};
const x = new Signal<{}, number>(owner);
const emission = testEmission(x, {
value: 'done'
});
x.emit(0);
expect(await emission).to.equal('done');
});
示例2: it
it('should update whether it is shown if activeStateChanged fires', () => {
const item = new Widget();
let active = false;
const isActive = () => active;
const activeStateChanged = new Signal<any, void>({});
statusBar.registerStatusItem('item', {
item,
isActive,
activeStateChanged
});
expect(item.isHidden).to.be.true;
active = true;
activeStateChanged.emit(void 0);
expect(item.isHidden).to.be.false;
});
示例3: expect
session.messageReceived.connect((sender, msg) => {
expect(sender).to.be(session);
if (msg.type === 'stdout') {
Signal.disconnectReceiver(object);
done();
}
}, object);
示例4: catch
signal.connect((sender: T, args: U) => {
if (!options.find || options.find(sender, args)) {
try {
Signal.disconnectReceiver(object);
if (options.test) {
options.test(sender, args);
}
} catch (e) {
done.reject(e);
}
done.resolve(options.value || undefined);
}
}, object);
示例5: expect
(s, type) => {
expect(defaultSession.path).to.equal(newPath);
expect(type).to.equal('path');
called = true;
Signal.disconnectReceiver(object);
},
示例6:
(s, args) => {
called = args;
Signal.disconnectReceiver(object);
},
示例7: expect
defaultSession.propertyChanged.connect((s, type) => {
expect(defaultSession.path).to.be(newPath);
expect(type).to.be('path');
called = true;
Signal.disconnectReceiver(object);
}, object);