From f0fdb9c479ae8b3bc7029e9ae40fcf76a3baa0cc Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 22 Jan 2025 17:19:03 +0800 Subject: [PATCH] 跨端通讯,协议注册警告优化 --- bases/BridgeCenterBase.js | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bases/BridgeCenterBase.js b/bases/BridgeCenterBase.js index 058f0fa..c1ffb56 100644 --- a/bases/BridgeCenterBase.js +++ b/bases/BridgeCenterBase.js @@ -15,10 +15,12 @@ _init(tellings) { tellings.forEach(method => { const name = Fetcher.prototype.stringToCamel(method); + // BridgeCenter 已注册,但没有定义接收器的协议,提示 if (typeof this[name] === 'undefined') { - console.warn('BridgeTelling:未发现“' + method + '”对应接收器!'); - } else { - // 注册App通知接收器 + console.warn('BridgeTelling:协议【' + method + '】未发现对应接收器!'); + } + // BridgeCenter 已注册已定义接收器的协议,注册接收器 + else { $bridge.register(method, (res, callback) => { this[name](method, res, callback); }); -- Gitblit v1.9.1