本文整理汇总了TypeScript中@jupyterlab/services.Session类的典型用法代码示例。如果您正苦于以下问题:TypeScript Session类的具体用法?TypeScript Session怎么用?TypeScript Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Session类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should fail for error response status', async () => {
const serverSettings = getRequestHandler(500, {});
const sessionModel = createSessionModel();
const options = createSessionOptions(sessionModel, serverSettings);
const sessionPromise = Session.startNew(options);
await expectFailure(sessionPromise, '');
});
开发者ID:afshin,项目名称:jupyterlab,代码行数:7,代码来源:session.spec.ts
示例2: it
it('should be safe to call twice', () => {
const session = Session.connectTo(defaultSession.model);
session.dispose();
expect(session.isDisposed).to.equal(true);
session.dispose();
expect(session.isDisposed).to.equal(true);
});
开发者ID:afshin,项目名称:jupyterlab,代码行数:7,代码来源:isession.spec.ts
示例3: main
function main() {
// Start a new session.
let options: Session.IOptions = {
kernelName: 'python',
path: 'foo.ipynb'
};
let session: Session.ISession;
log('Starting session');
Session.startNew(options).then(s => {
log('Session started');
session = s;
// Rename the session.
return session.setPath('bar.ipynb');
}).then(() => {
log(`Session renamed to ${session.path}`);
// Execute and handle replies on the kernel.
let future = session.kernel.requestExecute({ code: 'a = 1' });
future.onReply = (reply) => {
log('Got execute reply');
};
return future.done;
}).then(() => {
log('Future is fulfilled');
// Shut down the session.
return session.shutdown();
}).then(() => {
log('Session shut down');
log('Test Complete!');
}).catch(err => {
console.error(err);
log('Test Failed! See the console output for details');
});
}
开发者ID:7125messi,项目名称:jupyterlab,代码行数:34,代码来源:index.ts
示例4: 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']) {
Session.startNew({ path }).then(session => { startApp(session); });
return;
}
Session.findByPath(query['path'])
.then(model => { return Session.connectTo(model.id); })
.then(session => { startApp(session); })
.catch(error => {
console.warn(`path="${query['path']}"`, error);
Session.startNew({ path }).then(session => { startApp(session); });
});
}
开发者ID:danielballan,项目名称:jupyterlab,代码行数:24,代码来源:index.ts
注:本文中的@jupyterlab/services.Session类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论