本文整理匯總了TypeScript中vs/base/node/storage.Storage.getItems方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Storage.getItems方法的具體用法?TypeScript Storage.getItems怎麽用?TypeScript Storage.getItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/base/node/storage.Storage
的用法示例。
在下文中一共展示了Storage.getItems方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('multiple concurrent writes execute in sequence', async () => {
const storageDir = uniqueStorageDir();
await mkdirp(storageDir);
const storage = new Storage({ path: join(storageDir, 'storage.db') });
await storage.init();
storage.set('foo', 'bar');
storage.set('some/foo/path', 'some/bar/path');
await timeout(10);
storage.set('foo1', 'bar');
storage.set('some/foo1/path', 'some/bar/path');
await timeout(10);
storage.set('foo2', 'bar');
storage.set('some/foo2/path', 'some/bar/path');
await timeout(10);
storage.delete('foo1');
storage.delete('some/foo1/path');
await timeout(10);
storage.delete('foo4');
storage.delete('some/foo4/path');
await timeout(70);
storage.set('foo3', 'bar');
await storage.set('some/foo3/path', 'some/bar/path');
const items = await storage.getItems();
equal(items.get('foo'), 'bar');
equal(items.get('some/foo/path'), 'some/bar/path');
equal(items.has('foo1'), false);
equal(items.has('some/foo1/path'), false);
equal(items.get('foo2'), 'bar');
equal(items.get('some/foo2/path'), 'some/bar/path');
equal(items.get('foo3'), 'bar');
equal(items.get('some/foo3/path'), 'some/bar/path');
await storage.close();
await del(storageDir, tmpdir());
});