本文整理汇总了TypeScript中jupyter-js-services.ContentsManager.dirname方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ContentsManager.dirname方法的具体用法?TypeScript ContentsManager.dirname怎么用?TypeScript ContentsManager.dirname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jupyter-js-services.ContentsManager
的用法示例。
在下文中一共展示了ContentsManager.dirname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createConsole
execute: (args: ICreateConsoleArgs) => {
// If we get a session, use it.
if (args.sessionId) {
return manager.connectTo(args.sessionId).then(session => {
createConsole(session);
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).then(kernel => {
if (!kernel) {
return;
}
// Start the session.
let options: ISession.IOptions = {
path,
kernelName: kernel.name,
kernelId: kernel.id
};
return manager.startNew(options).then(session => {
createConsole(session);
return session.id;
});
});
}
示例2: 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;
}