Skip to content

Instantly share code, notes, and snippets.

@ghaiklor
Created February 3, 2017 15:57
Show Gist options
  • Save ghaiklor/45a906a618444604bbb3b04a570dd38e to your computer and use it in GitHub Desktop.
Save ghaiklor/45a906a618444604bbb3b04a570dd38e to your computer and use it in GitHub Desktop.
NativeModule.prototype.compile() sources
NativeModule.prototype.compile = function() {
var source = NativeModule.getSource(this.id);
source = NativeModule.wrap(source);
this.loading = true;
try {
const fn = runInThisContext(source, {
filename: this.filename,
lineOffset: 0,
displayErrors: true
});
fn(this.exports, NativeModule.require, this, this.filename);
this.loaded = true;
} finally {
this.loading = false;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment