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


TypeScript jupyter-js-services.startNewSession函数代码示例

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


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

示例1: main

function main(): void {
  startNewSession({
    path: 'fake_path',
  }).then(session => {
    startApp(session);
  });
}
开发者ID:jacpan,项目名称:jupyterlab,代码行数:7,代码来源:index.ts

示例2: main

function main() {
  // Start a new session.
  let options = {
    baseUrl: BASE_URL,
    wsUrl: WS_URL,
    kernelName: 'python',
    path: 'foo.ipynb'
  };
  startNewSession(options).then(session => {
    // Rename the session.
    session.rename('bar.ipynb').then(() => {
      console.log('Session renamed to', session.path);
      // Execute and handle replies on the kernel.
      let future = session.kernel.execute({ code: 'a = 1' });
      future.onReply = (reply) => {
        console.log('Got execute reply');
      };
      future.onDone = () => {
        console.log('Future is fulfilled');
        // Shut down the session.
        session.shutdown().then(() => {
          console.log('Session shut down');
          alert('Test Complete!  See the console output for details');
        });
      };
    });
  });
}
开发者ID:mahesh2013,项目名称:jupyter-js-services,代码行数:28,代码来源:index.ts

示例3: main

function main() {
  // Start a new session.
  let options = {
    baseUrl: BASE_URL,
    wsUrl: WS_URL,
    kernelName: 'python',
    notebookPath: 'foo.ipynb'
  };
  startNewSession(options).then(session => {
    // Rename the notebook.
    session.renameNotebook('bar.ipynb').then(() => {
      console.log('Notebook renamed to', session.notebookPath);
      // Execute and handle replies on the kernel.
      var future = session.kernel.execute({ code: 'a = 1' });
      future.onReply = (reply) => {
        console.log('Got execute reply');
      };
      future.onDone = () => {
        console.log('Future is fulfilled');
        // Shut down the session.
        session.shutdown().then(() => {
          console.log('Session shut down');
        });
      };
    });
  });
}
开发者ID:SimonBiggs,项目名称:jupyter-js-services,代码行数:27,代码来源:index.ts

示例4: getKernelSpecs

 getKernelSpecs({}).then(specs => {
   kernelspecs = specs;
   // start session
   startNewSession({
     notebookPath: NOTEBOOK,
     kernelName: findKernel(nbModel, specs),
     baseUrl: SERVER_URL
   }).then(session => {
     nbModel.session = session;
   });
 });
开发者ID:ellisonbg,项目名称:jupyter-js-notebook,代码行数:11,代码来源:index.ts

示例5: getKernelSpecs

 getKernelSpecs({}).then(specs => {
   kernelspecs = specs;
   let kernelName = specs.default;
   let language = specs.default;
   console.log('specs', specs);
   return startNewSession({
     notebookPath: 'fake_path',
     kernelName: findKernel(kernelName, language, specs),
     baseUrl: SERVER_URL
   });
 }).then(session => consoleModel.session = session);
开发者ID:SimonBiggs,项目名称:jupyter-js-notebook,代码行数:11,代码来源:index.ts

示例6: NotebookModel

  contents.get(NOTEBOOK, {}).then(data => {
    let nbModel = new NotebookModel();
    populateNotebookModel(nbModel, data.content as NotebookContent);
    let nbWidget = new NotebookWidget(nbModel);
    keymap.add(bindings(nbModel));
    nbWidget.attach(document.body);

    // start session
    startNewSession({
      notebookPath: NOTEBOOK,
      kernelName: data.content.metadata.kernelspec.name,
      baseUrl: SERVER_URL
    }).then(session => {
      nbModel.session = session;
      let content = getNotebookContent(nbModel);
      contents.save(NOTEBOOK, {
        type: 'notebook',
        content
      });
    });
  });
开发者ID:sccolbert,项目名称:jupyter-js-notebook,代码行数:21,代码来源:index.ts

示例7: main

function main(): void {
  let path = 'dummy_path';
  let query: { [key: string]: string } = Object.create(null);

  window.location.search.substr(1).split('&').forEach(item => {
    let pair = item.split('=');
    if (pair[0]) {
      query[pair[0]] = pair[1];
    }
  });

  if (!query['path']) {
    startNewSession({ path }).then(session => { startApp(session); });
    return;
  }

  findSessionByPath(query['path'])
    .then(model => { return connectToSession(model.id); })
    .then(session => { startApp(session); })
    .catch(error => {
      console.warn(`path="${query['path']}"`, error);
      startNewSession({ path }).then(session => { startApp(session); });
    });
}
开发者ID:dmadeka,项目名称:jupyterlab,代码行数:24,代码来源:index.ts

示例8: startNewSession

 .catch(error => {
   console.warn(`path="${query['path']}"`, error);
   startNewSession({ path }).then(session => { startApp(session); });
 });
开发者ID:dmadeka,项目名称:jupyterlab,代码行数:4,代码来源:index.ts


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