-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
98 additions
and
22 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# The first parameter is the desired extension | ||
extension=$1 | ||
shift | ||
|
||
# The other parameters are the files to be renamed with the extension | ||
for file in "$@"; do | ||
mv "$file" "${file%.*}.$extension" | ||
done |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const resolved = Promise.resolve(undefined); | ||
|
||
// Returns a function that asynchronously schedules a task | ||
export default function createTaskScheduler() : TaskScheduler { | ||
// Use or create a microtask scheduler | ||
const scheduleMicrotask = typeof queueMicrotask === 'function' ? | ||
queueMicrotask : (task: Task) => resolved.then(task); | ||
|
||
// If not in the browser, always use the microtask scheduler | ||
if (typeof window === 'undefined') | ||
return scheduleMicrotask; | ||
|
||
// In the browser, alternate with setTimeout to avoid freezing | ||
let i = 0; | ||
return (task: Task) => { | ||
if (++i < 100) | ||
scheduleMicrotask(task); | ||
else | ||
setTimeout(task, i = 0); | ||
} | ||
} | ||
|
||
export type Task = () => void; | ||
export type TaskScheduler = (task: Task) => void; |
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