mirror of
https://github.com/copy/v86.git
synced 2025-12-31 04:23:15 +00:00
Use global this for scheduler access
This makes libv86 work inside shared workers again.
This commit is contained in:
parent
db22e06746
commit
c004ebb3ab
1 changed files with 2 additions and 2 deletions
|
|
@ -114,12 +114,12 @@ if(typeof process !== "undefined")
|
|||
v86.prototype.register_yield = function() {};
|
||||
v86.prototype.unregister_yield = function() {};
|
||||
}
|
||||
else if(window["scheduler"] && typeof window["scheduler"]["postTask"] === "function" && location.href.includes("use-scheduling-api"))
|
||||
else if(globalThis["scheduler"] && typeof globalThis["scheduler"]["postTask"] === "function" && location.href.includes("use-scheduling-api"))
|
||||
{
|
||||
v86.prototype.yield = function(t, tick)
|
||||
{
|
||||
t = Math.max(0, t);
|
||||
window["scheduler"]["postTask"](() => this.yield_callback(tick), { delay: t });
|
||||
globalThis["scheduler"]["postTask"](() => this.yield_callback(tick), { delay: t });
|
||||
};
|
||||
|
||||
v86.prototype.register_yield = function() {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue