Skip to content

Commit bfa4382

Browse files
committed
Merge pull request #228 from wangxiao/init
初始化 init 方法支持传入服务器节点选项
2 parents 8048637 + b8efd7c commit bfa4382

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+325
-119
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
node_modules/
22
package/
3-
dist/js-sdk-api-docs/
43
*tgz
54
*.tar.gz
65
release.sh
76
coverage
87
*.swp
8+
dist/js-sdk-api-docs

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ JavaScript SDK for [LeanCloud](http://leancloud.cn/).
1313

1414
* fork 这个项目
1515
* `npm install` 安装相关依赖
16-
* 服务环境通过 mocha 调试单个文件,如调试 file.js `mocha test file`
1716
* 浏览器环境执行 `gulp dev`,会自动启动 demo 目录,可在 test-es6.js 中修改和测试,test-es5.js 为自动生成的代码
1817
* 确保测试全部通过 `gulp test`,浏览器环境打开 test/test.html
1918
* 提交并发起 Pull Request

demo/test-es5.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ AV.init({
77
appId: appId,
88
appKey: appKey
99
});
10-
// AV.initialize(appId, appKey);
1110

1211
var TestClass = AV.Object.extend('TestClass');
1312
var testObj = new TestClass();
@@ -20,4 +19,13 @@ testObj.save().then(function () {
2019
}).catch(function (err) {
2120
console.log('failed');
2221
console.log(err);
22+
});
23+
24+
var base64 = 'd29ya2luZyBhdCBhdm9zY2xvdWQgaXMgZ3JlYXQh';
25+
var file = new AV.File('myfile.txt', { base64: base64 });
26+
file.metaData('format', 'txt file');
27+
file.save().then(function (data) {
28+
console.log(data);
29+
}).catch(function (error) {
30+
console.log(error);
2331
});

demo/test-es6.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ AV.init({
55
appId: appId,
66
appKey: appKey
77
});
8-
// AV.initialize(appId, appKey);
98

109
const TestClass = AV.Object.extend('TestClass');
1110
const testObj = new TestClass();
@@ -19,3 +18,13 @@ testObj.save().then(() => {
1918
console.log('failed');
2019
console.log(err);
2120
});
21+
22+
const base64 = 'd29ya2luZyBhdCBhdm9zY2xvdWQgaXMgZ3JlYXQh';
23+
var file = new AV.File('myfile.txt', { base64: base64 });
24+
file.metaData('format', 'txt file');
25+
file.save().then((data) => {
26+
console.log(data);
27+
}).catch((error) => {
28+
console.log(error);
29+
});
30+

gulpfile.babel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* 每位工程师都有保持代码优雅的义务
3+
* Each engineer has a duty to keep the code elegant
4+
**/
5+
16
import path from 'path';
27
import qiniu from 'qiniu';
38
import fs from 'fs';

src/acl.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* 每位工程师都有保持代码优雅的义务
3+
* Each engineer has a duty to keep the code elegant
4+
**/
5+
16
'use strict';
27
var _ = require('underscore');
38

src/av-browser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* 每位工程师都有保持代码优雅的义务
3+
* Each engineer has a duty to keep the code elegant
4+
**/
5+
16
'use strict';
27

38
const AV = require('./av');

src/av.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
* The AVOS Cloud JavaScript SDK is freely distributable under the MIT license.
88
*/
99

10+
/**
11+
* 每位工程师都有保持代码优雅的义务
12+
* Each engineer has a duty to keep the code elegant
13+
**/
14+
1015
'use strict';
1116

1217
let AV = module.exports = {};

src/browserify-wrapper/ajax-browser.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* 每位工程师都有保持代码优雅的义务
3+
* Each engineer has a duty to keep the code elegant
4+
**/
5+
16
var Promise = require('../promise');
27

38
module.exports = function _ajax(method, url, data, success, error) {

src/browserify-wrapper/ajax.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* 每位工程师都有保持代码优雅的义务
3+
* Each engineer has a duty to keep the code elegant
4+
**/
5+
16
'use strict';
27

38
var http = require('http');

0 commit comments

Comments
 (0)