UNPKG

para-bridge-demo

Version:

a bridge api for js-ios/andriod rest

33 lines (32 loc) 945 B
``` tsx import { openNewUrl, openNewUrlWithDataCallback } from '../../../plugins/web/open-new-url'; /** * 打开新窗口, 下一个webview返回(data_callback) * 返回新数据并带上原始的信息. */ private openNewUrlWithCallback = () => { openNewUrlWithDataCallback( this.getHostUrl(`/_ntv_web_data_callback`), { extraKey: 'key' }, ).then((result) => { alert(JSON.stringify(result)); }).catch(err => { alert(JSON.stringify(err)); }); } /** * 打开新窗口,并且传递特定的数据信息到下一个webview, 待下一个webview返回(data_callback) * 返回新数据并带上原始的信息. */ private openNewUrlWithCallbackWithCbData = () => { openNewUrlWithDataCallback( this.getHostUrl(`/_ntv_web_data_callback`), { extraKey: 'key' }, { cbDataKey: 'cbKey1' }, ).then((result) => { alert(JSON.stringify(result)); }).catch(err => { alert(JSON.stringify(err)); }); } ```