You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
1.8 KiB

//
// MOBFWKWebViewContext.h
// MOBFoundation
//
// Created by 崔林豪 on 2018/11/6.
// Copyright © 2018年 MOB. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MOBFJSTypeDefine.h"
#import <WebKit/WebKit.h>
#include <JavaScriptCore/JavaScript.h>
NS_ASSUME_NONNULL_BEGIN
@interface MOBFWKWebViewContext : NSObject
@property (nonatomic, strong) WKWebView *webView;
/**
*
*
* @return
*/
+ (instancetype)defaultContext;
/**
@param webview Web视图
@return
*/
- (instancetype)initWithWKWebView:(WKWebView *)webview;
/**
*
*
* @param name
* @param block
*/
- (void)registerJSMethod:(NSString *)name block:(MOBFJSMethodIMP)block;
/**
*
*
* @param name
* @param arguments
*
* @return
*/
- (NSString *)callJSMethod:(NSString *)name arguments:(NSArray *)arguments;
/**
* JS解析器
*/
- (void)setupWKWebViewNewJSParser;
- (void)initWKWebViewDelegate:(WKWebView *)wkWebView;
/**
*
*
* @param path
* @param name
*/
- (void)loadPluginWithPath:(NSString *)path forName:(NSString *)name;
/**
*
*
* @param content
* @param name
*/
- (void)loadPlugin:(NSString *)content forName:(NSString *)name;
/**
*
*
* @param script
*/
- (void)runScript:(NSString *)script;
/**
* JS
*
* @param callback
* @param resultData
*/
- (void)callback:(NSString *)callback resultData:(NSDictionary *)resultData;
@end
NS_ASSUME_NONNULL_END