mirror of
https://github.com/amark/gun.git
synced 2025-06-07 06:36:46 +00:00
lib/ison: Use setTimeout instead of setImmediate. Allows the use of indexDB in browsers (#1226)
This commit is contained in:
parent
e3eaf5e268
commit
440bbffb73
10
lib/ison.js
10
lib/ison.js
@ -278,7 +278,7 @@ let stringifyWrapper = (value, replacer, space, intensity, callback) => {
|
|||||||
let g = rs.next();
|
let g = rs.next();
|
||||||
|
|
||||||
let yieldCPU = () => {
|
let yieldCPU = () => {
|
||||||
setImmediate(() => {
|
setTimeout(() => {
|
||||||
g = rs.next();
|
g = rs.next();
|
||||||
if (g && g.done === true) {
|
if (g && g.done === true) {
|
||||||
// Reinitializing the values at the end of API call
|
// Reinitializing the values at the end of API call
|
||||||
@ -291,7 +291,7 @@ let stringifyWrapper = (value, replacer, space, intensity, callback) => {
|
|||||||
return callback(null, yielding);
|
return callback(null, yielding);
|
||||||
}
|
}
|
||||||
yieldCPU();
|
yieldCPU();
|
||||||
});
|
}, 0);
|
||||||
};
|
};
|
||||||
return yieldCPU();
|
return yieldCPU();
|
||||||
};
|
};
|
||||||
@ -592,7 +592,7 @@ let parseWrapper = (text, reviver, intensity, cb) => {
|
|||||||
|
|
||||||
// Main yield control logic.
|
// Main yield control logic.
|
||||||
let yieldCPU = () => {
|
let yieldCPU = () => {
|
||||||
setImmediate(() => {
|
setTimeout(() => {
|
||||||
gen = rs.next();
|
gen = rs.next();
|
||||||
|
|
||||||
if (gen && gen.done === true) {
|
if (gen && gen.done === true) {
|
||||||
@ -618,7 +618,7 @@ let parseWrapper = (text, reviver, intensity, cb) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
yieldCPU();
|
yieldCPU();
|
||||||
});
|
}), 0;
|
||||||
};
|
};
|
||||||
return yieldCPU();
|
return yieldCPU();
|
||||||
};
|
};
|
||||||
@ -700,4 +700,4 @@ if(typeof JSON != ''+u){
|
|||||||
JSON.stringifyAsync = yson.stringifyAsync;
|
JSON.stringifyAsync = yson.stringifyAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user