Notify creation and destruction of native objects.
This commit is contained in:
parent
a513daae30
commit
bcfec7c8cd
1 changed files with 15 additions and 0 deletions
|
@ -11,6 +11,8 @@
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "browser/api/atom_api_event.h"
|
#include "browser/api/atom_api_event.h"
|
||||||
#include "common/v8_value_converter_impl.h"
|
#include "common/v8_value_converter_impl.h"
|
||||||
|
#include "vendor/node/src/node.h"
|
||||||
|
#include "vendor/node/src/node_internals.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -18,9 +20,22 @@ namespace api {
|
||||||
|
|
||||||
EventEmitter::EventEmitter(v8::Handle<v8::Object> wrapper) {
|
EventEmitter::EventEmitter(v8::Handle<v8::Object> wrapper) {
|
||||||
Wrap(wrapper);
|
Wrap(wrapper);
|
||||||
|
|
||||||
|
// process.emit('ATOM_BROWSER_INTERNAL_NEW', this).
|
||||||
|
v8::Handle<v8::Value> args[] = {
|
||||||
|
v8::String::New("ATOM_BROWSER_INTERNAL_NEW"),
|
||||||
|
wrapper,
|
||||||
|
};
|
||||||
|
node::MakeCallback(node::process, "emit", 2, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventEmitter::~EventEmitter() {
|
EventEmitter::~EventEmitter() {
|
||||||
|
// process.emit('ATOM_BROWSER_INTERNAL_DELETE', this).
|
||||||
|
v8::Handle<v8::Value> args[] = {
|
||||||
|
v8::String::New("ATOM_BROWSER_INTERNAL_DELETE"),
|
||||||
|
handle_,
|
||||||
|
};
|
||||||
|
node::MakeCallback(node::process, "emit", 2, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventEmitter::Emit(const std::string& name, base::ListValue* args) {
|
bool EventEmitter::Emit(const std::string& name, base::ListValue* args) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue