forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add return value to RuntimeScheduler unstable_scheduleCallback
Summary: Changelog: [internal] unstable_scheduleCallback needs to return reference to the created task so it can be cancelled later. Reviewed By: mdvacca Differential Revision: D27622779 fbshipit-source-id: 54160015c7f98e123d08c2e13efac4f498d3ba5e
- Loading branch information
1 parent
2779129
commit 3c14c19
Showing
2 changed files
with
31 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <folly/dynamic.h> | ||
#include <jsi/jsi.h> | ||
#include <react/renderer/runtimescheduler/Task.h> | ||
|
||
namespace facebook::react { | ||
|
||
struct TaskWrapper : public jsi::HostObject { | ||
TaskWrapper(std::shared_ptr<Task> const &task) : task(task) {} | ||
|
||
std::shared_ptr<Task> task; | ||
}; | ||
|
||
inline static jsi::Value valueFromTask( | ||
jsi::Runtime &runtime, | ||
std::shared_ptr<Task> const &task) { | ||
return jsi::Object::createFromHostObject( | ||
runtime, std::make_shared<TaskWrapper>(task)); | ||
} | ||
|
||
} // namespace facebook::react |