本文整理匯總了TypeScript中@jupyterlab/services.KernelMessage.createMessage方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript KernelMessage.createMessage方法的具體用法?TypeScript KernelMessage.createMessage怎麽用?TypeScript KernelMessage.createMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/services.KernelMessage
的用法示例。
在下文中一共展示了KernelMessage.createMessage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should check for a clear output message type', () => {
let msg = KernelMessage.createMessage({
msgType: 'clear_output',
channel: 'iopub',
session: 'baz'
});
expect(KernelMessage.isClearOutputMsg(msg)).to.equal(true);
msg = KernelMessage.createMessage({
msgType: 'foo',
channel: 'iopub',
session: 'baz'
});
expect(KernelMessage.isClearOutputMsg(msg)).to.equal(false);
});
示例2:
future.onReply = () => {
// trigger onStdin
options.channel = 'stdin';
newMsg = KernelMessage.createMessage(options);
newMsg.parent_header = msg.header;
tester.send(newMsg);
};
示例3: it
it('should throw if the channel is not a string', () => {
const msg = KernelMessage.createMessage({
msgType: 'comm_msg',
channel: 'iopub',
session: 'baz'
});
(msg as any).channel = 1;
expect(() => validateMessage(msg)).to.throw();
});