-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,068 additions
and
762 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
declare var globalThis; | ||
|
||
interface RuntimeData { | ||
asyncHandle: Record<number, (() => void)>, | ||
count: number | ||
asyncHandle: Record<number, () => void> | ||
count: number | ||
} | ||
|
||
var runtimeData: RuntimeData = { | ||
asyncHandle: [], | ||
count: 0 | ||
asyncHandle: [], | ||
count: 0, | ||
} | ||
|
||
export default async function bootstrap(entry: string) { | ||
globalThis.setTimeout = (fn: Function, delay: number, ...arg: any[]) => { | ||
runtimeData.asyncHandle[runtimeData.count] = () => { | ||
fn(...arg); | ||
} | ||
this.timer.send(runtimeData.count, delay) | ||
runtimeData.count++ | ||
//@ts-ignore | ||
globalThis.setTimeout = (fn: Function, delay: number, ...arg: any[]) => { | ||
runtimeData.asyncHandle[runtimeData.count] = () => { | ||
fn(...arg) | ||
} | ||
globalThis.exec = (id: number) => { | ||
if (runtimeData.asyncHandle[id]) { | ||
let fn = runtimeData.asyncHandle[id] | ||
delete runtimeData.asyncHandle[id] | ||
fn(); | ||
} | ||
this.timer.send(runtimeData.count, delay) | ||
runtimeData.count++ | ||
} | ||
globalThis.exec = (id: number) => { | ||
if (runtimeData.asyncHandle[id]) { | ||
let fn = runtimeData.asyncHandle[id] | ||
delete runtimeData.asyncHandle[id] | ||
fn() | ||
} | ||
} | ||
|
||
await import(entry) | ||
await import(entry) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import "https://deno.land/[email protected]/examples/welcome.ts"; | ||
import "https://deno.land/[email protected]/examples/welcome.ts"; | ||
|
||
const res = await import("./test1.ts"); | ||
console.log("res", res); | ||
console.log("res", res); | ||
const text = res.json() | ||
console.log("🚀 text", text); | ||
test.copy() | ||
try { | ||
const text = await res.json(); | ||
console.log("🚀 text", text); | ||
test.copy(); | ||
} catch (err) { | ||
console.error("err => ", err); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
setTimeout( | ||
(...arg: number[]) => { | ||
console.log("Hello Timeout", ...arg); | ||
}, | ||
1000, | ||
1, | ||
2, | ||
3, | ||
); | ||
console.log("Welcome Timeout!"); | ||
setTimeout((...arg: number[]) => { | ||
console.log("Hello Timeout", ...arg) | ||
}, 1000, 1, 2, 3); | ||
console.log("Welcome Timeout!") | ||
setTimeout((...arg: number[]) => { | ||
console.log("Timeout 2", ...arg) | ||
console.log("Timeout 2", ...arg, /^bin$/g); | ||
}, 100); | ||
|
||
|
||
export default { | ||
copy() { | ||
console.log("1121") | ||
} | ||
} | ||
copy() { | ||
console.log("1121"); | ||
}, | ||
}; | ||
|
||
export function* x() {} |