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.
|
|
|
|
|
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_H_
|
|
|
|
|
|
|
|
#include "gin/wrappable.h"
|
|
|
|
#include "shell/common/gin_helper/constructible.h"
|
|
|
|
|
2024-07-29 17:42:57 +00:00
|
|
|
namespace gin {
|
|
|
|
template <typename T>
|
|
|
|
class Handle;
|
|
|
|
} // namespace gin
|
|
|
|
|
2023-02-13 21:39:18 +00:00
|
|
|
namespace v8 {
|
|
|
|
class Isolate;
|
|
|
|
template <typename T>
|
|
|
|
class Local;
|
|
|
|
class Object;
|
|
|
|
class ObjectTemplate;
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
namespace gin_helper::internal {
|
|
|
|
|
2024-09-04 23:40:02 +00:00
|
|
|
class Event final : public gin::Wrappable<Event>,
|
|
|
|
public gin_helper::Constructible<Event> {
|
2023-02-13 21:39:18 +00:00
|
|
|
public:
|
|
|
|
// gin_helper::Constructible
|
|
|
|
static gin::Handle<Event> New(v8::Isolate* isolate);
|
|
|
|
static v8::Local<v8::ObjectTemplate> FillObjectTemplate(
|
|
|
|
v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::ObjectTemplate> prototype);
|
2023-07-10 09:49:20 +00:00
|
|
|
static const char* GetClassName() { return "Event"; }
|
2023-02-13 21:39:18 +00:00
|
|
|
|
|
|
|
// gin::Wrappable
|
|
|
|
static gin::WrapperInfo kWrapperInfo;
|
2024-03-06 11:45:28 +00:00
|
|
|
const char* GetTypeName() override;
|
2023-02-13 21:39:18 +00:00
|
|
|
|
|
|
|
~Event() override;
|
|
|
|
|
|
|
|
void PreventDefault() { default_prevented_ = true; }
|
|
|
|
|
|
|
|
bool GetDefaultPrevented() { return default_prevented_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Event();
|
|
|
|
|
|
|
|
bool default_prevented_ = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin_helper::internal
|
|
|
|
|
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_H_
|