@@ -125,6 +125,10 @@ const init = (AV) => {
125125 AV . _useMasterKey = false ;
126126 } ;
127127
128+ const masterKeyWarn = ( ) => {
129+ console . warn ( 'MasterKey is not supposed to be used in browser.' ) ;
130+ } ;
131+
128132 /**
129133 * Call this method first to set up your authentication tokens for AV.
130134 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
@@ -136,12 +140,6 @@ const init = (AV) => {
136140 */
137141
138142 AV . init = ( ...args ) => {
139- const masterKeyWarn = ( ) => {
140- console . warn ( 'MasterKey should not be used in the browser. ' +
141- 'The permissions of MasterKey can be across all the server permissions,' +
142- ' including the setting of ACL .' ) ;
143- } ;
144-
145143 switch ( args . length ) {
146144 case 1 :
147145 const options = args [ 0 ] ;
@@ -151,17 +149,13 @@ const init = (AV) => {
151149 }
152150 initialize ( options . appId , options . appKey , options . masterKey ) ;
153151 request . setServerUrlByRegion ( options . region ) ;
154- AVConfig . disableCurrentUser = options . disableCurrentUser ;
155152 } else {
156153 throw new Error ( 'AV.init(): Parameter is not correct.' ) ;
157154 }
158155 break ;
159156 // 兼容旧版本的初始化方法
160157 case 2 :
161158 case 3 :
162- console . warn ( 'Please use AV.init() to replace AV.initialize(), ' +
163- 'AV.init() need an Object param, like { appId: \'YOUR_APP_ID\', appKey: \'YOUR_APP_KEY\' } . ' +
164- 'Docs: https://leancloud.cn/docs/sdk_setup-js.html' ) ;
165159 if ( ! AVConfig . isNode && args . length === 3 ) {
166160 masterKeyWarn ( ) ;
167161 }
0 commit comments