UNPKG

para-bridge-demo

Version:

a bridge api for js-ios/andriod rest

38 lines (32 loc) 978 B
import { BridgePlugin } from '../bridge'; interface ISetWebviewCacheParam { projectTag: string; setMap: { [index: string]: string; }; } interface ISetWebviewCacheResult { // 状态 0:不支持 | 1:成功 status: '0' | '1'; } export class SetWebviewCache<K> extends BridgePlugin<ISetWebviewCacheParam, K>{ protected get ntvPluginName() { return "_ntv_util_set_webview_cache"; } protected get availableMinVersion() { return "1.0.1"; } protected bridgeExecChrome(pluginName: string | undefined): void { // 可针对不同运行环境实现特定的调用逻辑来MOCK,弥补平台差异性. throw new Error('SetWebviewCache() 未针对当前环境实现'); } } /** * 设置缓存信息 * @returns 是否支持缓存 */ export const setWebviewCache = (param: ISetWebviewCacheParam) => { return new SetWebviewCache<ISetWebviewCacheResult>(param).invokeOnce().then(result => { return result.cbData.status === '1'; }); }