本文整理匯總了TypeScript中@jupyterlab/services.utils.uuid方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript utils.uuid方法的具體用法?TypeScript utils.uuid怎麽用?TypeScript utils.uuid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/services.utils
的用法示例。
在下文中一共展示了utils.uuid方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createFactory
function createFactory() {
return new WidgetFactory({
name: utils.uuid(),
fileExtensions: ['.txt', '.foo.bar'],
defaultFor: ['.txt', '.foo.bar']
});
}
示例2: beforeEach
beforeEach(() => {
let path = utils.uuid() + '.py';
context = new Context({ manager, factory: modelFactory, path });
widget = new EditorWidget({
factory: options => factoryService.newDocumentEditor(options),
mimeTypeService,
context
});
});
示例3: 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
});
});
示例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);
});
示例5: 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);
}
示例6: 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);
}
示例7: 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;
});
});
}
示例8: 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;
});
});
}
示例9:
context.save().then(() => {
return manager.contents.rename(context.path, utils.uuid() + '.jl');
}).catch(done);
示例10: createContext
function createContext(): Context<DocumentRegistry.IModel> {
let factory = new TextModelFactory();
let manager = new ServiceManager();
let path = utils.uuid() + '.csv';
return new Context({ factory, manager, path });
}