当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript coreutils.UUID类代码示例

本文整理汇总了TypeScript中@phosphor/coreutils.UUID的典型用法代码示例。如果您正苦于以下问题:TypeScript UUID类的具体用法?TypeScript UUID怎么用?TypeScript UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UUID类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('should be emitted for an unhandled message', async () => {
      const kernel = await tester.start();
      const msgId = UUID.uuid4();

      const emission = testEmission(kernel.anyMessage, {
        test: (k, args) => {
          expect(args.msg.header.msg_id).to.equal(msgId);
          expect(args.msg.header.msg_type).to.equal('foo');
          expect(args.direction).to.equal('recv');
        }
      });

      const msg = KernelMessage.createShellMessage({
        msgType: 'foo',
        channel: 'shell',
        session: tester.serverSessionId,
        msgId
      });
      msg.parent_header = { session: kernel.clientId };
      tester.send(msg);
      await emission;
    });
开发者ID:willingc,项目名称:jupyterlab,代码行数:22,代码来源:ikernel.spec.ts

示例2: it

 it('should keep the file if overwrite is aborted', async () => {
   const oldPath = context.path;
   const newPath = UUID.uuid4() + '.txt';
   const func = async () => {
     await waitForDialog();
     const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
     const input = dialog.getElementsByTagName('input')[0];
     input.value = newPath;
     await acceptDialog(); // Accept rename dialog
     await dismissDialog(); // Reject conflict dialog
   };
   await manager.contents.save(newPath, {
     type: factory.contentType,
     format: factory.fileFormat,
     content: 'foo'
   });
   await context.initialize(true);
   const promise = func();
   await context.saveAs();
   await promise;
   expect(context.path).to.equal(oldPath);
 });
开发者ID:alexmorley,项目名称:jupyterlab,代码行数:22,代码来源:context.spec.ts

示例3: it

    it('should send a binary message', async () => {
      const tester = new KernelTester();
      const kernel = await tester.start();
      const done = new PromiseDelegate<void>();
      const msgId = UUID.uuid4();

      tester.onMessage(msg => {
        try {
          const decoder = new TextDecoder('utf8');
          const item = msg.buffers[0] as DataView;
          expect(decoder.decode(item)).to.equal('hello');
        } catch (e) {
          done.reject(e);
          throw e;
        }
        done.resolve(null);
      });

      const options: KernelMessage.IOptions = {
        msgType: 'custom',
        channel: 'shell',
        username: kernel.username,
        session: kernel.clientId,
        msgId
      };
      const encoder = new TextEncoder();
      const data = encoder.encode('hello');
      const msg = KernelMessage.createShellMessage(options, {}, {}, [
        data,
        data.buffer
      ]);
      kernel.sendShellMessage(msg, true);
      await done.promise;
      await tester.shutdown();
      tester.dispose();
    });
开发者ID:afshin,项目名称:jupyterlab,代码行数:36,代码来源:ikernel.spec.ts

示例4: beforeAll

 beforeAll(async () => {
   session = await Session.startNew({ path: UUID.uuid4() });
   await session.kernel.ready;
 });
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:4,代码来源:manager.spec.ts

示例5: it

 it('should start a session', async () => {
   const session = await manager.startNew({ path: UUID.uuid4() });
   await session.kernel.ready;
   expect(session.id).to.be.ok;
   return session.shutdown();
 });
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:6,代码来源:manager.spec.ts

示例6: startNew

/**
 * Start a new session with a unique name.
 */
function startNew(): Promise<Session.ISession> {
  return Session.startNew({ path: UUID.uuid4() });
}
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:6,代码来源:session.spec.ts

示例7: it

 it('should accept ajax options', async () => {
   const serverSettings = makeSettings();
   const options: Session.IOptions = { path: UUID.uuid4(), serverSettings };
   session = await Session.startNew(options);
   expect(session.id).to.be.ok;
 });
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:6,代码来源:session.spec.ts

示例8: it

 it('should fail if the session is disposed', async () => {
   const session = Session.connectTo(defaultSession.model);
   session.dispose();
   const promise = session.setPath(UUID.uuid4());
   await expectFailure(promise, 'Session is disposed');
 });
开发者ID:willingc,项目名称:jupyterlab,代码行数:6,代码来源:session.spec.ts


注:本文中的@phosphor/coreutils.UUID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。