當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript PathExt.dirname方法代碼示例

本文整理匯總了TypeScript中@jupyterlab/coreutils.PathExt.dirname方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PathExt.dirname方法的具體用法?TypeScript PathExt.dirname怎麽用?TypeScript PathExt.dirname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@jupyterlab/coreutils.PathExt的用法示例。


在下文中一共展示了PathExt.dirname方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: hasGitNotebook

  /**
   * Whether the notebook is in a git repository.
   */
  function hasGitNotebook(): boolean {
    if (!baseEnabled()) {
      return false;
    }

    let path = tracker.currentWidget!.context.path;
    let dir = PathExt.dirname(path);
    let known_git = lut_known_git[dir];
    if (known_git === undefined) {
      const inGitPromise = isNbInGit({path: dir});
      inGitPromise.then(inGit => {
        networkRetry = INITIAL_NETWORK_RETRY;
        lut_known_git[dir] = inGit;
        // Only update if false, since it is left enabled while waiting
        if (!inGit) {
          commands.notifyCommandChanged(CommandIDs.diffNotebookGit);
        }
      });
      inGitPromise.catch((reason) => {
        hasAPI = reason.status !== undefined && reason.status !== 404;
        setTimeout(() => {
          networkRetry *= 2;
          commands.notifyCommandChanged(CommandIDs.diffNotebook);
          commands.notifyCommandChanged(CommandIDs.diffNotebookCheckpoint);
          commands.notifyCommandChanged(CommandIDs.diffNotebookGit);
        }, networkRetry);
      });
      // Leave button enabled while unsure
      return true;
    }

    return known_git;
  }
開發者ID:vidartf,項目名稱:nbdime,代碼行數:36,代碼來源:plugin.ts

示例2: renameFile

 }).then(result => {
   if (!result.value) {
     return null;
   }
   let basePath = PathExt.dirname(oldPath);
   let newPath = PathExt.join(basePath, result.value);
   return renameFile(manager, oldPath, newPath);
 });
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:8,代碼來源:dialogs.ts

示例3: diffNotebookCheckpoint

function diffNotebookCheckpoint(args: {readonly path: string, readonly rendermime: IRenderMimeRegistry}): Widget {
  const {path, rendermime} = args;
  let nb_dir = PathExt.dirname(path);
  let name = PathExt.basename(path, '.ipynb');
  let base = PathExt.join(nb_dir, name + '.ipynb');
  let widget = new NbdimeWidget({base, rendermime, baseLabel: 'Checkpoint'});
  widget.title.label = `Diff checkpoint: ${name}`;
  widget.title.caption = `Local: latest checkpoint\nRemote: '${path}'`;
  widget.title.iconClass = 'fa fa-clock-o jp-fa-tabIcon';
  return widget;
}
開發者ID:vidartf,項目名稱:nbdime,代碼行數:11,代碼來源:actions.ts

示例4: showErrorMessage

 }).then(result => {
   if (!isValidFileName(result.value)) {
     showErrorMessage('Rename Error', Error(
         `"${result.value}" is not a valid name for a file. ` +
         `Names must have nonzero length, ` +
         `and cannot include "/", "\\", or ":"`
     ));
     return null;
   }
   let basePath = PathExt.dirname(oldPath);
   let newPath = PathExt.join(basePath, result.value);
   return renameFile(manager, oldPath, newPath);
 });
開發者ID:SimonBiggs,項目名稱:jupyterlab,代碼行數:13,代碼來源:dialogs.ts

示例5:

 return restored.then(() => model.cd(`/${PathExt.dirname(localPath)}`));
開發者ID:ellisonbg,項目名稱:jupyterlab,代碼行數:1,代碼來源:index.ts

示例6: it

 it('should not return "." for a path in the root directory', () => {
   let path = PathExt.dirname('foo.txt');
   expect(path).to.equal('');
 });
開發者ID:7125messi,項目名稱:jupyterlab,代碼行數:4,代碼來源:path.spec.ts

示例7:

 .then(() => model.cd(`/${PathExt.dirname(localPath)}`))
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:1,代碼來源:index.ts


注:本文中的@jupyterlab/coreutils.PathExt.dirname方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。