atom_api_event.cc 1018 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) 2018 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "native_mate/dictionary.h"
  5. #include "shell/browser/api/event_emitter.h"
  6. #include "shell/common/node_includes.h"
  7. namespace {
  8. v8::Local<v8::Object> CreateWithSender(v8::Isolate* isolate,
  9. v8::Local<v8::Object> sender) {
  10. return mate::internal::CreateJSEvent(isolate, sender, nullptr, base::nullopt);
  11. }
  12. v8::Local<v8::Object> CreateEmpty(v8::Isolate* isolate) {
  13. return mate::internal::CreateEmptyJSEvent(isolate);
  14. }
  15. void Initialize(v8::Local<v8::Object> exports,
  16. v8::Local<v8::Value> unused,
  17. v8::Local<v8::Context> context,
  18. void* priv) {
  19. mate::Dictionary dict(context->GetIsolate(), exports);
  20. dict.SetMethod("createWithSender", &CreateWithSender);
  21. dict.SetMethod("createEmpty", &CreateEmpty);
  22. }
  23. } // namespace
  24. NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_event, Initialize)