2023-02-13 21:39:18 +00:00
|
|
|
// 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"
|
2024-07-29 17:42:57 +00:00
|
|
|
#include "gin/handle.h"
|
2023-02-13 21:39:18 +00:00
|
|
|
#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};
|
|
|
|
|
2024-03-06 11:45:28 +00:00
|
|
|
const char* Event::GetTypeName() {
|
|
|
|
return GetClassName();
|
|
|
|
}
|
|
|
|
|
2023-02-13 21:39:18 +00:00
|
|
|
} // namespace gin_helper::internal
|