@@ -98,30 +98,35 @@ module.exports = function(AV) {
9898 } ;
9999
100100 /**
101- * Call this method first to set up your authentication tokens for LC.
102- * You can get your keys from the Data Browser on http://leancloud.cn .
103- * @param {Object } incloud appId, appKey, masterKey
104- */
101+ * Call this method first to set up your authentication tokens for AV.
102+ * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
103+ * @function AV.init
104+ * @param args initialize options.
105+ * @param args.appId application id
106+ * @param args.appKey application key
107+ * @param args.masterKey application master key
108+ */
105109
106- AV . init = ( ...options ) => {
107- switch ( options . length ) {
110+ AV . init = ( ...args ) => {
111+ switch ( args . length ) {
108112 case 1 :
113+ const options = args [ 0 ] ;
109114 if ( typeof options === 'object' ) {
110115 if ( ! AV . _config . isNode && options . masterKey ) {
111116 throw new Error ( 'AV.init(): Master Key is only used in Node.js.' ) ;
112117 }
113- initialize ( options [ 0 ] . appId , options [ 0 ] . appKey , options [ 0 ] . masterKey ) ;
118+ initialize ( options . appId , options . appKey , options . masterKey ) ;
114119 } else {
115120 throw new Error ( 'AV.init(): Parameter is not correct.' ) ;
116121 }
117122 break ;
118123 // 兼容旧版本的初始化方法
119124 case 2 :
120125 case 3 :
121- if ( ! AV . _config . isNode && options . length === 3 ) {
126+ if ( ! AV . _config . isNode && args . length === 3 ) {
122127 throw new Error ( 'AV.init(): Master Key is only used in Node.js.' ) ;
123128 }
124- initialize ( ...options ) ;
129+ initialize ( ...args ) ;
125130 break ;
126131 }
127132 } ;
@@ -146,6 +151,7 @@ module.exports = function(AV) {
146151
147152 /**
148153 * Call this method to set production environment variable.
154+ * @function AV.setProduction
149155 * @param {Boolean } production True is production environment,and
150156 * it's true by default.
151157 */
0 commit comments