2019-10-21 09:59:22 +08:00
|
|
|
/*
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2019-07-26 14:19:42 +08:00
|
|
|
//
|
|
|
|
// DoricJSEngine.h
|
|
|
|
// Doric
|
|
|
|
//
|
|
|
|
// Created by pengfei.zhou on 2019/7/26.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
2019-07-27 14:36:41 +08:00
|
|
|
#import <JavaScriptCore/JavaScriptCore.h>
|
2020-02-26 11:50:18 +08:00
|
|
|
|
2019-07-27 14:36:41 +08:00
|
|
|
#import "DoricRegistry.h"
|
2020-02-26 11:50:18 +08:00
|
|
|
#import "DoricJSExecutorProtocol.h"
|
2019-07-26 14:19:42 +08:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@interface DoricJSEngine : NSObject
|
|
|
|
|
2020-02-26 11:50:18 +08:00
|
|
|
@property(nonatomic, strong) id <DoricJSExecutorProtocol> jsExecutor;
|
|
|
|
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2019-10-12 14:48:19 +08:00
|
|
|
@property(nonatomic, strong) DoricRegistry *registry;
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2019-07-29 13:48:27 +08:00
|
|
|
- (void)prepareContext:(NSString *)contextId script:(NSString *)script source:(NSString *)source;
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2019-07-29 13:48:27 +08:00
|
|
|
- (void)destroyContext:(NSString *)contextId;
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2020-04-20 11:03:48 +08:00
|
|
|
- (JSValue *)invokeDoricMethod:(NSString *)method, ... NS_REQUIRES_NIL_TERMINATION;
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2019-07-29 13:48:27 +08:00
|
|
|
- (JSValue *)invokeDoricMethod:(NSString *)method arguments:(va_list)args;
|
2019-07-27 14:36:41 +08:00
|
|
|
|
2019-07-29 13:48:27 +08:00
|
|
|
- (JSValue *)invokeDoricMethod:(NSString *)method argumentsArray:(NSArray *)args;
|
2020-05-13 10:02:22 +08:00
|
|
|
|
|
|
|
- (void)ensureRunOnJSThread:(dispatch_block_t)block;
|
2021-02-22 19:03:34 +08:00
|
|
|
|
|
|
|
- (void)initJSEngine;
|
2021-03-04 10:02:29 +08:00
|
|
|
|
|
|
|
- (void)teardown;
|
2021-07-07 12:44:40 +08:00
|
|
|
|
2021-07-07 17:30:08 +08:00
|
|
|
- (void)setEnvironmentValue:(NSDictionary *)value;
|
2019-07-26 14:19:42 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|