client/src/sagas/utils.js
author ymh <ymh.work@gmail.com>
Fri, 28 Jul 2017 19:40:35 +0200
changeset 129 d48946d164c6
permissions -rw-r--r--
Add a first version of synchronisation Remove redux-offline dependency make the redux state fully immutable TODO: better error management TODO: make syncronization work automatically
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
129
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
// Utility function to delay effects
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
export const delay = function(millis) {
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
    const promise = new Promise(resolve => {
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
        setTimeout(() => resolve(true), millis)
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
    });
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
    return promise;
d48946d164c6 Add a first version of synchronisation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
}