Add BIND_DONE event for process object

This commit is contained in:
Cheng Zhao 2014-10-25 23:21:17 +08:00
parent e110f5c37c
commit 24b4fcea15
3 changed files with 6 additions and 4 deletions

View file

@ -23,9 +23,8 @@ process.argv.splice startMark, endMark - startMark + 1
globalPaths = module.globalPaths
globalPaths.push path.join process.resourcesPath, 'atom', 'browser', 'api', 'lib'
# Do loading in next tick since we still need some initialize work before
# native bindings can work.
setImmediate ->
# Following operations need extra bindings by AtomBindings.
process.once 'BIND_DONE', ->
# Import common settings.
require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js')

View file

@ -85,6 +85,9 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
versions->Set(mate::StringToV8(isolate, "chrome"),
mate::StringToV8(isolate, CHROME_VERSION_STRING));
}
v8::Handle<v8::Value> event = mate::StringToV8(isolate, "BIND_DONE");
node::MakeCallback(isolate, process, "emit", 1, &event);
}
void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) {

View file

@ -84,5 +84,5 @@ if nodeIntegration in ['true', 'all', 'except-iframe', 'manual-enable-iframe']
else
# There still some native initialization codes needs "process", delete the
# global reference after they are done.
setImmediate ->
process.once 'BIND_DONE', ->
delete global.process