How to use the @lumino/coreutils.UUID.uuid4 function in @lumino/coreutils

To help you get started, we’ve selected a few @lumino/coreutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-services / src / utils.ts View on Github external
sock.on('message', (msg: any) => {
      if (msg instanceof Buffer) {
        msg = new Uint8Array(msg).buffer;
      }
      const data = deserialize(msg);
      if (data.header.msg_type === 'kernel_info_request') {
        // First send status busy message.
        this.parentHeader = data.header;
        this.sendStatus(UUID.uuid4(), 'busy');

        // Then send the kernel_info_reply message.
        this.sendKernelInfoReply(UUID.uuid4(), EXAMPLE_KERNEL_INFO);

        // Then send status idle message.
        this.sendStatus(UUID.uuid4(), 'idle');
        this.parentHeader = undefined;
      } else {
        const onMessage = this._onMessage;
        if (onMessage) {
          onMessage(data);
        }
      }
    });
  }
github jupyterlab / jupyterlab / tests / test-console / src / foreign.spec.ts View on Github external
before(async function() {
      // tslint:disable-next-line:no-invalid-this
      this.timeout(60000);

      const path = UUID.uuid4();
      [local, foreign, session] = await Promise.all([
        Session.startNew({ path }),
        Session.startNew({ path }),
        createClientSession({ path })
      ]);

      // check path prop
      expect(local.path).to.equal(path);

      await (session as ClientSession).initialize();
      await session.kernel.ready;
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
it('should update the title when the path changes', async () => {
        const path = UUID.uuid4() + '.jl';
        await context.initialize(true);
        await manager.contents.rename(context.path, path);
        expect(widget.title.label).to.equal(path);
      });
github jupyterlab / jupyterlab / tests / test-services / src / utils.ts View on Github external
export function createSessionModel(id?: string): Session.IModel {
  return {
    id: id || UUID.uuid4(),
    path: UUID.uuid4(),
    name: '',
    type: '',
    kernel: { id: UUID.uuid4(), name: UUID.uuid4() }
  };
}
github jupyterlab / jupyterlab / tests / test-services / src / config / config.spec.ts View on Github external
function randomName() {
  return UUID.uuid4().replace(/-/g, '');
}
github jupyterlab / jupyterlab / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
beforeEach(() => {
    const registry = new DocumentRegistry({ textModelFactory });
    registry.addWidgetFactory(widgetFactory);
    manager = new LoggingManager({ registry });
    context = new Context({
      manager: services,
      factory: textModelFactory,
      path: UUID.uuid4()
    });
  });
github jupyterlab / lumino / examples / example-datastore / src / messages.ts View on Github external
function createMessage(
    msgType: T['msgType'],
    content?: T['content'],
    parentId?: string
  ): T {
    let msgId = UUID.uuid4();
    if (content === undefined) {
      content = {};
    }
    return {
      msgId,
      msgType,
      parentId,
      content,
    } as T;
  }
github jupyterlab / lumino / examples / example-datastore / src / messages.ts View on Github external
function createReply(
    msgType: T['msgType'],
    content: T['content'],
    parentId: string
  ): T {
    let msgId = UUID.uuid4();
    return {
      msgId,
      msgType,
      parentId,
      content
    } as T;
  }