Created
August 12, 2015 16:58
-
-
Save ghaiklor/259372c5049dbc52b947 to your computer and use it in GitHub Desktop.
DefineJavaScript method in NodeJS that loading all the JS modules
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
void DefineJavaScript(Environment* env, Handle<Object> target) { | |
HandleScope scope(env->isolate()); | |
for (int i = 0; natives[i].name; i++) { | |
if (natives[i].source != node_native) { | |
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name); | |
Handle<String> source = String::NewFromUtf8(env->isolate(), natives[i].source, String::kNormalString, natives[i].source_len); | |
target->Set(name, source); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment