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


TypeScript ContentsManager.dirname方法代码示例

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


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

示例1: caption

 function caption(options: ICaptionOptions): string {
   let { label, path, displayName, connected, executed } = options;
   let caption = (
     `Name: ${label}\n` +
     `Directory: ${ContentsManager.dirname(path)}\n` +
     `Kernel: ${displayName}\n` +
     `Connected: ${dateTime(connected.toISOString())}`
   );
   if (executed) {
     caption += `\nLast Execution: ${dateTime(executed.toISOString())}`;
   }
   return caption;
 }
开发者ID:Carreau,项目名称:jupyterlab,代码行数:13,代码来源:plugin.ts

示例2: 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

示例3: 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.ContentsManager.dirname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。