refactor: simplify events (#37099)
This commit is contained in:
parent
8b3e498436
commit
71944f2c3b
32 changed files with 290 additions and 409 deletions
31
shell/common/gin_helper/event.cc
Normal file
31
shell/common/gin_helper/event.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) 2023 Salesforce, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/common/gin_helper/event.h"
|
||||
#include "gin/dictionary.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
|
||||
namespace gin_helper::internal {
|
||||
|
||||
// static
|
||||
gin::Handle<Event> Event::New(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, new Event());
|
||||
}
|
||||
// static
|
||||
v8::Local<v8::ObjectTemplate> Event::FillObjectTemplate(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::ObjectTemplate> templ) {
|
||||
return gin::ObjectTemplateBuilder(isolate, "Event", templ)
|
||||
.SetMethod("preventDefault", &Event::PreventDefault)
|
||||
.SetProperty("defaultPrevented", &Event::GetDefaultPrevented)
|
||||
.Build();
|
||||
}
|
||||
|
||||
Event::Event() = default;
|
||||
|
||||
Event::~Event() = default;
|
||||
|
||||
gin::WrapperInfo Event::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
} // namespace gin_helper::internal
|
Loading…
Add table
Add a link
Reference in a new issue