本文整理汇总了TypeScript中localforage.ready函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ready函数的具体用法?TypeScript ready怎么用?TypeScript ready使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ready函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(function() {
observableLogs = [];
errorCallCount = 0;
completeCallCount = 0;
return localforage
.ready()
.then(() => localforage.clear())
.then(() => {
observable = localforage.getItemObservable('UserProfile');
});
});
示例2: beforeEach
beforeEach(function() {
return localforage
.ready()
.then(() => localforage.clear())
.then(() => {
const observable = localforage.newObservable();
subscription = observable.subscribe({
next: (change: LocalForageObservableChange) =>
observableLogs.push(formatChangeArg(change)),
error: err => {
errorCallCount++;
console.error('Found an error!', err);
},
complete: () => {
completeCallCount++;
},
});
});
});
示例3: beforeEach
beforeEach(function() {
return localforage
.ready()
.then(() => localforage.clear())
.then(() => {
const setItemCallObservable = localforage.newObservable({
setItem: true,
changeDetection: false,
});
setItemSubscription = setItemCallObservable.subscribe({
next: (change: LocalForageObservableChange) =>
setItemObservableLogs.push(formatChangeArg(change)),
error: err => {
errorCallCount++;
console.error('Found an error!', err);
},
complete: () => {
completeCallCount++;
},
});
const clearCallObservable = localforage.newObservable({
clear: true,
changeDetection: false,
});
clearSubscription = clearCallObservable.subscribe({
next: (change: LocalForageObservableChange) =>
clearObservableLogs.push(formatChangeArg(change)),
error: err => {
errorCallCount++;
console.error('Found an error!', err);
},
complete: () => {
completeCallCount++;
},
});
});
});
示例4: it
it('should get ready', function() {
return m.chai.expect(localforage.ready()).to.eventually.be.fulfilled;
});