event.cc 905 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) 2023 Salesforce, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "shell/common/gin_helper/event.h"
  5. #include "gin/dictionary.h"
  6. #include "gin/object_template_builder.h"
  7. namespace gin_helper::internal {
  8. // static
  9. gin::Handle<Event> Event::New(v8::Isolate* isolate) {
  10. return gin::CreateHandle(isolate, new Event());
  11. }
  12. // static
  13. v8::Local<v8::ObjectTemplate> Event::FillObjectTemplate(
  14. v8::Isolate* isolate,
  15. v8::Local<v8::ObjectTemplate> templ) {
  16. return gin::ObjectTemplateBuilder(isolate, "Event", templ)
  17. .SetMethod("preventDefault", &Event::PreventDefault)
  18. .SetProperty("defaultPrevented", &Event::GetDefaultPrevented)
  19. .Build();
  20. }
  21. Event::Event() = default;
  22. Event::~Event() = default;
  23. gin::WrapperInfo Event::kWrapperInfo = {gin::kEmbedderNativeGin};
  24. } // namespace gin_helper::internal