本文整理匯總了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;
});