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


TypeScript services.utils类代码示例

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


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

示例1: createFactory

function createFactory() {
  return new WidgetFactory({
    name: utils.uuid(),
    fileExtensions: ['.txt', '.foo.bar'],
    defaultFor: ['.txt', '.foo.bar']
  });
}
开发者ID:faricacarroll,项目名称:jupyterlab,代码行数:7,代码来源:registry.spec.ts

示例2: beforeEach

 beforeEach(() => {
   let path = utils.uuid() + '.py';
   context = new Context({ manager, factory: modelFactory, path });
   widget = new EditorWidget({
     factory: (host: Widget) => factory.newDocumentEditor(host.node, {}),
     mimeTypeService,
     context
   });
 });
开发者ID:fperez,项目名称:jupyterlab,代码行数:9,代码来源:widget.spec.ts

示例3: beforeEach

 beforeEach(() => {
   let path = utils.uuid() + '.py';
   context = new Context({ manager, factory: modelFactory, path });
   widget = new EditorWidget({
     factory: options => factoryService.newDocumentEditor(options),
     mimeTypeService,
     context
   });
 });
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:9,代码来源:widget.spec.ts

示例4: it

 it('should update the title when the path changes', (done) => {
   let path = utils.uuid() + '.jl';
   context.pathChanged.connect((sender, args) => {
     expect(widget.title.label).to.be(path);
     done();
   });
   context.save().then(() => {
     return manager.contents.rename(context.path, path);
   }).catch(done);
 });
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:10,代码来源:widget.spec.ts

示例5: attachHelp

 execute: () => {
   // If help resource will generate a mixed content error, load externally.
   if (LAB_IS_SECURE && utils.urlParse(command.url).protocol !== 'https:') {
     window.open(command.url);
     return;
   }
   attachHelp();
   iframe.url = command.url;
   showHelp();
 }
开发者ID:danielballan,项目名称:jupyterlab,代码行数:10,代码来源:plugin.ts

示例6: newDocumentEditor

 /**
  * Create a new editor for a full document.
  */
 newDocumentEditor(host: HTMLElement, options: CodeEditor.IOptions): CodeEditor.IEditor {
   return this.newEditor(host, {
     uuid: utils.uuid(),
     extraKeys: {
       'Tab': 'indentMore',
       'Shift-Enter': () => { /* no-op */ }
     },
     indentUnit: 4,
     theme: DEFAULT_CODEMIRROR_THEME,
     lineNumbers: true,
     lineWrapping: true
   }, options);
 }
开发者ID:fperez,项目名称:jupyterlab,代码行数:16,代码来源:factory.ts

示例7: newClosableIFrame

    execute: args => {
      const url = args['url'] as string;
      const text = args['text'] as string;

      // If help resource will generate a mixed content error, load externally.
      if (LAB_IS_SECURE && utils.urlParse(url).protocol !== 'https:') {
        window.open(url);
        return;
      }

      let iframe = newClosableIFrame(url, text);
      app.shell.addToMainArea(iframe);
      app.shell.activateMain(iframe.id);
    }
开发者ID:rlugojr,项目名称:jupyterlab,代码行数:14,代码来源:plugin.ts

示例8: newInlineEditor

 /**
  * Create a new editor for inline code.
  */
 newInlineEditor(host: HTMLElement, options: CodeEditor.IOptions): CodeEditor.IEditor {
   return this.newEditor(host, {
     uuid: utils.uuid(),
     indentUnit: 4,
     theme: DEFAULT_CODEMIRROR_THEME,
     extraKeys: {
       'Cmd-Right': 'goLineRight',
       'End': 'goLineRight',
       'Cmd-Left': 'goLineLeft',
       'Tab': 'indentMore',
       'Shift-Tab': 'indentLess',
       'Cmd-Alt-[': 'indentAuto',
       'Ctrl-Alt-[': 'indentAuto',
       'Cmd-/': 'toggleComment',
       'Ctrl-/': 'toggleComment',
     }
   }, options);
 }
开发者ID:fperez,项目名称:jupyterlab,代码行数:21,代码来源:factory.ts

示例9: createConsole

    execute: (args: ICreateConsoleArgs) => {
      args = args || {};

      let name = `Console ${++count}`;

      // If we get a session, use it.
      if (args.id) {
        return manager.ready.then(() => {
          return manager.connectTo(args.id);
        }).then(session => {
          name = session.path.split('/').pop();
          name = `Console ${name.match(CONSOLE_REGEX)[1]}`;
          createConsole(session, name);
          return session.id;
        });
      }

      // Find the correct path for the new session.
      // Use the given path or the cwd.
      let path = args.path || pathTracker.path;
      if (ContentsManager.extname(path)) {
        path = ContentsManager.dirname(path);
      }
      path = `${path}/console-${count}-${utils.uuid()}`;

      // Get the kernel model.
      return manager.ready.then(() => getKernel(args, name)).then(kernel => {
        if (!kernel || (kernel && !kernel.id && !kernel.name)) {
          return;
        }
        // Start the session.
        let options: Session.IOptions = {
          path,
          kernelName: kernel.name,
          kernelId: kernel.id
        };
        return manager.startNew(options).then(session => {
          createConsole(session, name);
          return session.id;
        });
      });
    }
开发者ID:danielballan,项目名称:jupyterlab,代码行数:42,代码来源:plugin.ts

示例10: createConsole

    execute: (args: ICreateConsoleArgs) => {
      args = args || {};

      let name = `Console ${++count}`;

      // If we get a session, use it.
      if (args.sessionId) {
        return manager.connectTo(args.sessionId).then(session => {
          createConsole(session, name);
          return session.id;
        });
      }

      // Find the correct path for the new session.
      // Use the given path or the cwd.
      let path = args.path || pathTracker.path;
      if (ContentsManager.extname(path)) {
        path = ContentsManager.dirname(path);
      }
      path = `${path}/console-${utils.uuid()}`;

      // Get the kernel model.
      return getKernel(args, name).then(kernel => {
        if (!kernel) {
          return;
        }
        // Start the session.
        let options: Session.IOptions = {
          path,
          kernelName: kernel.name,
          kernelId: kernel.id
        };
        return manager.startNew(options).then(session => {
          createConsole(session, name);
          return session.id;
        });
      });
    }
开发者ID:marami52,项目名称:jupyterlab,代码行数:38,代码来源:plugin.ts


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