Latest 0.0.9
Homepage https://github.com/wanhmr/TPJsBridge
License MIT
Platforms ios 8.0, requires ARC
Frameworks WebKit
Authors

An iOS/OSX bridge for sending messages between Obj-C and JavaScript in WKWebView.

TPJsBridge 是一个插件化的 jsBridge 库,参考了 cordova,但做了简化,能够实现复杂的 native 与 wap 的交互

HOW TO USE

pod 'TPJsBridge', '~> 0.0.9'

Initialization code:
NSString *configFilePath = [[NSBundle mainBundle] pathForResource:@"TPCustomJsBridgeConfig" ofType:@"json"];

NSString *apiBuildFilePath = [[NSBundle mainBundle] pathForResource:@"TPCustomJsBridgeApiBuild" ofType:@"js"];

self.service = [[TPJsService alloc] initWithConfigFilePath:configFilePath apiBuildFilePath:apiBuildFilePath];

[self.service connect:webView];
自定义 Plugin 流程:
1.继承 TPJsPlugin 
2.实现功能 
3.在 TPCustomJsBridgeApiBuild.js 文件中创建接口 
4.在 TPCustomJsBridgeConfig.json 中声明 Plugin 
上面步骤完成就可以使用了 
具体请参考 TPJsPlugin_viewPageManager 实现

screenshot

Latest podspec

{
    "name": "TPJsBridge",
    "version": "0.0.9",
    "summary": "An iOS bridge for sending messages between Obj-C and JavaScript in WKWebView.",
    "homepage": "https://github.com/wanhmr/TPJsBridge",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tpphha": ""
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/wanhmr/TPJsBridge.git",
        "tag": "0.0.9"
    },
    "source_files": "TPJsBridge/**/*.{h,m}",
    "public_header_files": "TPJsBridge/**/*.{h}",
    "resources": "TPJsBridge/TPJsBridge.bundle",
    "frameworks": "WebKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This