本文整理匯總了TypeScript中@jupyterlab/filebrowser.FileBrowserModel.uploads方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FileBrowserModel.uploads方法的具體用法?TypeScript FileBrowserModel.uploads怎麽用?TypeScript FileBrowserModel.uploads使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/filebrowser.FileBrowserModel
的用法示例。
在下文中一共展示了FileBrowserModel.uploads方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it(`should produce progress as a large file uploads`, async () => {
const fname = UUID.uuid4() + '.txt';
const file = new File([new ArrayBuffer(2 * CHUNK_SIZE)], fname);
const {
cleanup,
values: [start, first, second, finished]
} = signalToPromises(model.uploadChanged, 4);
model.upload(file);
expect(iteratorToList(model.uploads())).to.eql([]);
expect(await start).to.eql([
model,
{
name: 'start',
oldValue: null,
newValue: { path: fname, progress: 0 }
}
]);
expect(iteratorToList(model.uploads())).to.eql([
{ path: fname, progress: 0 }
]);
expect(await first).to.eql([
model,
{
name: 'update',
oldValue: { path: fname, progress: 0 },
newValue: { path: fname, progress: 0 }
}
]);
expect(iteratorToList(model.uploads())).to.eql([
{ path: fname, progress: 0 }
]);
expect(await second).to.eql([
model,
{
name: 'update',
oldValue: { path: fname, progress: 0 },
newValue: { path: fname, progress: 1 / 2 }
}
]);
expect(iteratorToList(model.uploads())).to.eql([
{ path: fname, progress: 1 / 2 }
]);
expect(await finished).to.eql([
model,
{
name: 'finish',
oldValue: { path: fname, progress: 1 / 2 },
newValue: null
}
]);
expect(iteratorToList(model.uploads())).to.eql([]);
cleanup();
});