本文整理汇总了TypeScript中@jupyterlab/docregistry.Context.save方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Context.save方法的具体用法?TypeScript Context.save怎么用?TypeScript Context.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/docregistry.Context
的用法示例。
在下文中一共展示了Context.save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should revert to the file on disk', (done) => {
context.model.fromString('foo');
context.save().then(() => {
context.fileChanged.connect(() => {
expect(context.model.toString()).to.be('bar');
done();
});
setTimeout(() => {
manager.contents.save(context.path, {
type: factory.contentType,
format: factory.fileFormat,
content: 'bar'
}).catch(done);
handler.saveInterval = 1;
handler.start();
context.model.fromString('baz');
}, 1500); // The server has a one second resolution for saves.
}).catch(done);
waitForDialog().then(() => {
let dialog = document.body.getElementsByClassName('jp-Dialog')[0];
let buttons = dialog.getElementsByTagName('button');
for (let i = 0; i < buttons.length; i++) {
if (buttons[i].textContent === 'REVERT') {
buttons[i].click();
}
}
});
});
示例2: it
it('should be set after poulation', (done) => {
context.ready.then(() => {
expect(context.contentsModel.name).to.be('foo');
done();
});
context.save().catch(done);
});
示例3: it
it('should create a checkpoint for the file', () => {
return context.save().then(() => {
return context.createCheckpoint();
}).then(model => {
expect(model.id).to.be.ok();
expect(model.last_modified).to.be.ok();
});
});
示例4: it
it('should revert the contents of the file to the disk', async () => {
await context.initialize(true);
context.model.fromString('foo');
await context.save();
context.model.fromString('bar');
await context.revert();
expect(context.model.toString()).to.equal('foo');
});