Created
August 10, 2019 15:18
-
-
Save elliotdavies/c95af3693fe92dfd48a96d1dd2fdbd11 to your computer and use it in GitHub Desktop.
PureScript async imports
This file contains hidden or 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
var PS = {}; | |
// Either need to rename FFI modules (e.g. `$PS["Effect.Console.FFI"]`) or else | |
// combine them as shown here to avoid recursive promise calls | |
(function($PS) { | |
$PS["Effect.Console"] = $PS["Effect.Console"] || Promise.resolve({}); | |
$PS["Effect.Console"] = $PS["Effect.Console"].then(exports => { | |
exports["log"] = function(s) { | |
return function() { | |
console.log(s); | |
return {}; | |
}; | |
}; | |
return exports; | |
}); | |
})(PS); | |
(function($PS) { | |
$PS["Main"] = $PS["Main"] || Promise.resolve({}); | |
$PS["Main"] = $PS["Main"].then(exports => { | |
return $PS["Effect.Console"].then(Effect_Console => { | |
var main = Effect_Console.log("\ud83c\udf5d"); | |
exports["main"] = main; | |
return exports; | |
}); | |
}); | |
})(PS); | |
module.exports = PS; |
This file contains hidden or 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
const PS = require('./output/bundle.js'); | |
PS.Main.then(Main => { | |
Main.main(); | |
}); | |
//-> "🍝" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment