2018-10-18 03:36:45 +00:00
|
|
|
// Copyright (c) 2018 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-10-24 05:47:58 +00:00
|
|
|
#include "shell/browser/api/event.h"
|
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
|
|
|
#include "shell/common/gin_helper/event_emitter.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/node_includes.h"
|
2018-10-18 03:36:45 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
v8::Local<v8::Object> CreateWithSender(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Object> sender) {
|
2019-10-24 05:47:58 +00:00
|
|
|
return gin_helper::internal::CreateEvent(isolate, sender);
|
2019-07-29 20:54:37 +00:00
|
|
|
}
|
|
|
|
|
2018-10-18 03:36:45 +00:00
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
|
|
v8::Local<v8::Value> unused,
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
void* priv) {
|
2019-10-24 05:47:58 +00:00
|
|
|
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
2018-10-18 03:36:45 +00:00
|
|
|
dict.SetMethod("createWithSender", &CreateWithSender);
|
2019-10-31 07:56:00 +00:00
|
|
|
dict.SetMethod("createEmpty", &gin_helper::Event::Create);
|
2018-10-18 03:36:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2020-02-14 11:25:39 +00:00
|
|
|
NODE_LINKED_MODULE_CONTEXT_AWARE(electron_browser_event, Initialize)
|