From 9607c973f9613213f572085897660de2dbbb0cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=B5=A9?= Date: Wed, 23 Dec 2020 13:30:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8DisAppRegistered?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99console.warn=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 11b89ef..1f0dac8 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; -import { DeviceEventEmitter, NativeModules, Platform } from 'react-native'; import { EventEmitter } from 'events'; +import { DeviceEventEmitter, NativeModules, Platform } from 'react-native'; let isAppRegistered = false; const { WeChat } = NativeModules; @@ -25,12 +25,12 @@ function wrapRegisterApp(nativeFunc) { if (isAppRegistered) { return Promise.resolve(true); } - isAppRegistered = true; return new Promise((resolve, reject) => { nativeFunc.apply(null, [ ...args, (error, result) => { if (!error) { + isAppRegistered = true; return resolve(result); } if (typeof error === 'string') { @@ -165,7 +165,6 @@ const nativeSubscribeMessage = wrapApi(WeChat.subscribeMessage); * @return {Promise} */ export function sendAuthRequest(scopes, state) { - console.warn('sendAuthRequest') return new Promise((resolve, reject) => { WeChat.sendAuthRequest(scopes, state, () => {}); emitter.once('SendAuth.Resp', resp => {