MCPcopy
hub / github.com/localForage/localForage / rerequirelocalforage

Function rerequirelocalforage

test/test.callwhenready.js:7–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5 var previousDriver = localforage.driver();
6
7 function rerequirelocalforage() {
8 // The API method stubs inserted by callWhenReady must be tested before
9 // they are replaced by the driver, which happens as soon as it loads.
10 //
11 // To ensure that they work when the drivers are loaded asynchronously,
12 // we run the entire test suite (except for config tests), but undefine
13 // the localforage module and force it to reload before each test, so that
14 // it will be initialized again.
15 //
16 // This ensures that the synchronous parts of localforage initialization
17 // and the API calls in the tests occur first in every test, such that the
18 // callWhenReady API method stubs are called before RequireJS
19 // asynchronously loads the drivers that replace them.
20 require.undef('localforage');
21 require(['localforage'], function(localforage) {
22 localforage.setDriver(previousDriver);
23 window.localforage = localforage;
24 done();
25 });
26 }
27
28 localforage.ready().then(
29 function() {

Callers 1

Calls 1

setDriverMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…