-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix several issues with JS bindings (#131)
- Loading branch information
Showing
7 changed files
with
95 additions
and
37 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Note: this function comes from https://stackoverflow.com/questions/30401486/ecma6-generators-yield-promise. | ||
// It is used to convert a generator function into a promise. | ||
// `jco transpile` generates a similar function but it didn't work for me. | ||
// I'm not sure why, but I'll raise an issue on the `jco` repo. | ||
// See the `justfile` for how this gets shimmed into the transpiled code; | ||
// in short, we use `ripgrep` as in | ||
// https://unix.stackexchange.com/questions/181180/replace-multiline-string-in-files | ||
// (it was a Stack-Overflow heavy day...) | ||
// The indentation is intentional so the function matches the original. | ||
function run(g) { | ||
return Promise.resolve(function step(v) { | ||
const res = g.next(v); | ||
if (res.done) return res.value; | ||
return res.value.then(step); | ||
}()); | ||
} | ||
return run(gen); |
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