electron/shell/browser/api/event.h
Josh Soref ea4278754c
chore: fix spelling errors in multiple files (#34574)
* chore: fix spelling in .circleci

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in BUILD.gn

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in appveyor.yml

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in build

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in docs

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in lib

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in script

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in shell

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in spec

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

* chore: fix spelling in spec-main

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-06-16 16:46:11 +09:00

52 lines
1.3 KiB
C++

// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_API_EVENT_H_
#define ELECTRON_SHELL_BROWSER_API_EVENT_H_
#include "electron/shell/common/api/api.mojom.h"
#include "gin/handle.h"
#include "gin/wrappable.h"
namespace gin_helper {
class Event : public gin::Wrappable<Event> {
public:
using InvokeCallback = electron::mojom::ElectronApiIPC::InvokeCallback;
static gin::WrapperInfo kWrapperInfo;
static gin::Handle<Event> Create(v8::Isolate* isolate);
// Pass the callback to be invoked.
void SetCallback(InvokeCallback callback);
// event.PreventDefault().
void PreventDefault(v8::Isolate* isolate);
// event.sendReply(value), used for replying to synchronous messages and
// `invoke` calls.
bool SendReply(v8::Isolate* isolate, v8::Local<v8::Value> result);
// disable copy
Event(const Event&) = delete;
Event& operator=(const Event&) = delete;
protected:
Event();
~Event() override;
// gin::Wrappable:
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
const char* GetTypeName() override;
private:
// Replier for the synchronous messages.
InvokeCallback callback_;
};
} // namespace gin_helper
#endif // ELECTRON_SHELL_BROWSER_API_EVENT_H_