2017-02-01 22:10:41 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
2017-03-17 13:55:44 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2017-07-10 12:21:03 +00:00
|
|
|
#import <JavaScriptCore/JavaScriptCore.h>
|
|
|
|
|
|
|
|
#import <cxxreact/JSCExecutor.h>
|
|
|
|
#import <jschelpers/JavaScriptCore.h>
|
2017-02-01 22:10:41 +00:00
|
|
|
|
2017-03-17 13:55:44 +00:00
|
|
|
@class RCTBridge;
|
|
|
|
@class RCTModuleData;
|
|
|
|
|
2017-02-15 14:12:46 +00:00
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
2017-03-17 13:55:44 +00:00
|
|
|
class Instance;
|
|
|
|
|
2017-04-07 16:27:05 +00:00
|
|
|
std::vector<std::unique_ptr<NativeModule>> createNativeModules(NSArray<RCTModuleData *> *modules, RCTBridge *bridge, const std::shared_ptr<Instance> &instance);
|
2017-03-17 13:55:44 +00:00
|
|
|
|
2017-02-16 21:56:26 +00:00
|
|
|
JSContext *contextForGlobalContextRef(JSGlobalContextRef contextRef);
|
|
|
|
|
2017-08-07 13:41:15 +00:00
|
|
|
template<>
|
|
|
|
struct JSCValueEncoder<id> {
|
|
|
|
static Value toJSCValue(JSGlobalContextRef ctx, id obj) {
|
|
|
|
JSValue *value = [JSC_JSValue(ctx) valueWithObject:obj inContext:contextForGlobalContextRef(ctx)];
|
2017-02-16 21:56:26 +00:00
|
|
|
return {ctx, [value JSValueRef]};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-15 14:12:46 +00:00
|
|
|
NSError *tryAndReturnError(const std::function<void()>& func);
|
2017-06-14 21:06:26 +00:00
|
|
|
NSString *deriveSourceURL(NSURL *url);
|
2017-02-15 14:12:46 +00:00
|
|
|
|
|
|
|
} }
|