本文整理匯總了TypeScript中@jupyterlab/coreutils.uuid函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript uuid函數的具體用法?TypeScript uuid怎麽用?TypeScript uuid使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了uuid函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createSessionModel
/**
* Create a unique session id.
*/
function createSessionModel(id = ''): Session.IModel {
return {
id: id || uuid(),
notebook: { path: uuid() },
kernel: { id: uuid(), name: uuid() }
};
}
示例2: it
it('should not be emitted for an iopub signal', async () => {
const kernel = await tester.start();
// We'll send two messages, first an iopub message, then a shell message.
// The unhandledMessage signal should only emit once for the shell message.
const msgId = uuid();
const emission = testEmission(kernel.unhandledMessage, {
test: (k, msg) => { expect(msg.header.msg_id).to.be(msgId); }
});
// Send an iopub message.
tester.sendStatus(uuid(), 'idle');
// Send a shell message.
let msg = KernelMessage.createShellMessage({
msgType: 'foo',
channel: 'shell',
session: tester.serverSessionId,
msgId
});
msg.parent_header = {session: kernel.clientId};
tester.send(msg);
await emission;
});
示例3: it
it('should generate a random 32 character hex string', () => {
let id0 = uuid();
let id1 = uuid();
expect(id0.length).to.equal(32);
expect(id1.length).to.equal(32);
expect(id0).to.not.equal(id1);
});
示例4: createSessionModel
/**
* Create a unique session id.
*/
function createSessionModel(id = ''): Session.IModel {
return {
id: id || uuid(),
path: uuid(),
type: '',
name: '',
kernel: { id: uuid(), name: uuid() }
};
}
示例5: beforeEach
beforeEach((done) => {
tester = new KernelTester();
data = [{ id: uuid(), name: 'test' },
{ id: uuid(), name: 'test2' }];
tester.runningKernels = data;
manager = new KernelManager();
expect(manager.specs).to.be(null);
expect(manager.running().next()).to.be(void 0);
manager.ready.then(done, done);
});
示例6: it
it('should yield a list of valid kernel ids', (done) => {
let data = [
{ id: uuid(), name: 'test' },
{ id: uuid(), name: 'test2' }
];
tester.runningKernels = data;
Kernel.listRunning().then(response => {
let running = toArray(response);
expect(running[0]).to.eql(data[0]);
expect(running[1]).to.eql(data[1]);
done();
});
});
示例7: createFactory
function createFactory() {
return new WidgetFactory({
name: uuid(),
fileExtensions: ['.txt', '.foo.bar'],
defaultFor: ['.txt', '.foo.bar']
});
}