-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
834 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#include "module_callback.h" | ||
|
||
#include <utility> | ||
|
||
namespace webf { | ||
|
||
std::shared_ptr<ModuleCallback> ModuleCallback::Create(const std::shared_ptr<QJSFunction>& function) { | ||
return std::make_shared<ModuleCallback>(function); | ||
} | ||
|
||
ModuleCallback::ModuleCallback(std::shared_ptr<QJSFunction> function) : function_(std::move(function)) {} | ||
|
||
std::shared_ptr<QJSFunction> ModuleCallback::value() { | ||
return function_; | ||
} | ||
|
||
} // namespace webf | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#include "module_callback.h" | ||
|
||
#include <utility> | ||
|
||
namespace webf { | ||
|
||
std::shared_ptr<ModuleCallback> ModuleCallback::Create(const std::shared_ptr<Function>& function) { | ||
return std::make_shared<ModuleCallback>(function); | ||
} | ||
|
||
ModuleCallback::ModuleCallback(std::shared_ptr<Function> function) : function_(std::move(function)) {} | ||
|
||
std::shared_ptr<Function> ModuleCallback::value() { | ||
return function_; | ||
} | ||
|
||
} // namespace webf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#ifndef BRIDGE_MODULE_CALLBACK_H | ||
#define BRIDGE_MODULE_CALLBACK_H | ||
|
||
#include <quickjs/list.h> | ||
#include "bindings/qjs/qjs_function.h" | ||
|
||
namespace webf { | ||
|
||
// ModuleCallback is an asynchronous callback function, usually from the 4th parameter of `webf.invokeModule` | ||
// function. When the asynchronous operation on the Dart side ends, the callback is will called and to return to the JS | ||
// executing environment. | ||
class ModuleCallback { | ||
public: | ||
static std::shared_ptr<ModuleCallback> Create(const std::shared_ptr<QJSFunction>& function); | ||
explicit ModuleCallback(std::shared_ptr<QJSFunction> function); | ||
|
||
std::shared_ptr<QJSFunction> value(); | ||
|
||
private: | ||
std::shared_ptr<QJSFunction> function_{nullptr}; | ||
}; | ||
|
||
} // namespace webf | ||
|
||
#endif // BRIDGE_MODULE_CALLBACK_H | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#ifndef BRIDGE_MODULE_CALLBACK_H | ||
#define BRIDGE_MODULE_CALLBACK_H | ||
|
||
#include <quickjs/list.h> | ||
#include "bindings/qjs/qjs_function.h" | ||
|
||
namespace webf { | ||
|
||
// ModuleCallback is an asynchronous callback function, usually from the 4th parameter of `webf.invokeModule` | ||
// function. When the asynchronous operation on the Dart side ends, the callback is will called and to return to the JS | ||
// executing environment. | ||
class ModuleCallback { | ||
public: | ||
static std::shared_ptr<ModuleCallback> Create(const std::shared_ptr<Function>& function); | ||
explicit ModuleCallback(std::shared_ptr<Function> function); | ||
|
||
std::shared_ptr<Function> value(); | ||
|
||
private: | ||
std::shared_ptr<Function> function_{nullptr}; | ||
}; | ||
|
||
} // namespace webf | ||
|
||
#endif // BRIDGE_MODULE_CALLBACK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#include "module_listener.h" | ||
|
||
#include <utility> | ||
|
||
namespace webf { | ||
|
||
std::shared_ptr<ModuleListener> ModuleListener::Create(const std::shared_ptr<QJSFunction>& function) { | ||
return std::make_shared<ModuleListener>(function); | ||
} | ||
|
||
ModuleListener::ModuleListener(std::shared_ptr<QJSFunction> function) : function_(std::move(function)) {} | ||
|
||
const std::shared_ptr<QJSFunction>& ModuleListener::value() { | ||
return function_; | ||
} | ||
|
||
} // namespace webf | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#include "module_listener.h" | ||
|
||
#include <utility> | ||
|
||
namespace webf { | ||
|
||
std::shared_ptr<ModuleListener> ModuleListener::Create(const std::shared_ptr<Function>& function) { | ||
return std::make_shared<ModuleListener>(function); | ||
} | ||
|
||
ModuleListener::ModuleListener(std::shared_ptr<Function> function) : function_(std::move(function)) {} | ||
|
||
const std::shared_ptr<Function>& ModuleListener::value() { | ||
return function_; | ||
} | ||
|
||
} // namespace webf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#ifndef BRIDGE_MODULE_LISTENER_H | ||
#define BRIDGE_MODULE_LISTENER_H | ||
|
||
#include "bindings/qjs/qjs_function.h" | ||
|
||
namespace webf { | ||
|
||
class ModuleContextCoordinator; | ||
class ModuleListenerContainer; | ||
|
||
// ModuleListener is an persistent callback function. Registered from user with `webf.addModuleListener` method. | ||
// When module event triggered at dart side, All module listener will be invoked and let user to dispatch further | ||
// operations. | ||
class ModuleListener { | ||
public: | ||
static std::shared_ptr<ModuleListener> Create(const std::shared_ptr<QJSFunction>& function); | ||
explicit ModuleListener(std::shared_ptr<QJSFunction> function); | ||
|
||
const std::shared_ptr<QJSFunction>& value(); | ||
|
||
private: | ||
std::shared_ptr<QJSFunction> function_{nullptr}; | ||
|
||
friend ModuleListenerContainer; | ||
friend ModuleContextCoordinator; | ||
}; | ||
|
||
} // namespace webf | ||
|
||
#endif // BRIDGE_MODULE_LISTENER_H | ||
/* | ||
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved. | ||
* Copyright (C) 2022-present The WebF authors. All rights reserved. | ||
*/ | ||
#ifndef BRIDGE_MODULE_LISTENER_H | ||
#define BRIDGE_MODULE_LISTENER_H | ||
|
||
#include "bindings/qjs/qjs_function.h" | ||
|
||
namespace webf { | ||
|
||
class ModuleContextCoordinator; | ||
class ModuleListenerContainer; | ||
|
||
// ModuleListener is an persistent callback function. Registered from user with `webf.addModuleListener` method. | ||
// When module event triggered at dart side, All module listener will be invoked and let user to dispatch further | ||
// operations. | ||
class ModuleListener { | ||
public: | ||
static std::shared_ptr<ModuleListener> Create(const std::shared_ptr<Function>& function); | ||
explicit ModuleListener(std::shared_ptr<Function> function); | ||
|
||
const std::shared_ptr<Function>& value(); | ||
|
||
private: | ||
std::shared_ptr<Function> function_{nullptr}; | ||
|
||
friend ModuleListenerContainer; | ||
friend ModuleContextCoordinator; | ||
}; | ||
|
||
} // namespace webf | ||
|
||
#endif // BRIDGE_MODULE_LISTENER_H |
Oops, something went wrong.