Skip to content

Commit c02b647

Browse files
committed
Merge pull request #157 from wangxiao/master
[bugfix] 兼容 IE8+,发布 2.3.0
2 parents 446817c + 520e6cb commit c02b647

File tree

11 files changed

+48
-21
lines changed

11 files changed

+48
-21
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: node_js
22
node_js:
33
- "0.12"
4+
- "4"
45
sudo: false
56
before_install:
67
- npm install bower grunt-cli -g

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
## 贡献
77
如果你希望为这个项目贡献代码,请按以下步骤进行:
88
* fork 这个项目
9-
* `grunt dev` 在本地进行调试
9+
* 在目录中执行 `npm install` 安装所需 node 依赖包
10+
* 在目录中执行 `bower install` 安装所需 Web 依赖库
11+
* 执行 `grunt dev` 浏览器打开 http://localhost:8000 本地进行调试
12+
* 修改 `src` 目录中的源码,系统会自动生成调试代码
13+
* `grunt release` 打包生成 dist
1014
* 确保 `grunt test` 的测试全部 pass
1115
* 提交并发起 PR
1216

17+
其他说明:`grunt dev` 会监听每次 `src` 目录中的改动,自动进行 `grunt release` 打包操作,不需要再手动执行一次。
18+
1319
项目的目录结构说明如下:
1420
```
1521
.

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.3.0
2+
### Features
3+
* 增加 `invited`, `kicked`, `membersjoined`, `membersleft` 事件,废弃 `join`, `left` 事件
4+
5+
### Bug Fixes
6+
* 修复 IE8、IE9 无法连接服务器的 bug
7+
* 修复没有加入的 conversation 无法查询成员的 bug
8+
19
## 2.2.1
210
### Features
311
* 内置 [ws](https://www.npmjs.com/package/ws) 作为默认 WebSocket 实现,在 node 运行环境中使用时不再要求配置 WebSocket 类。

dist/AV.realtime.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ AV.realtime = require('./realtime');
99
},{"./realtime":2}],2:[function(require,module,exports){
1010
(function (global){
1111
/**
12-
* @author wangxiao
13-
* @date 2015-05-25
14-
* @homepage http://github.com/leancloud/js-realtime-sdk/
12+
* @author wangxiao liye
13+
* @see http://github.com/leancloud/js-realtime-sdk/
1514
*
1615
* 每位工程师都有保持代码优雅的义务
1716
* Each engineer has a duty to keep the code elegant
@@ -1303,6 +1302,11 @@ module.exports = function (options, callback) {
13031302
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
13041303
var xhr = new XMLHttpRequest();
13051304

1305+
// 浏览器兼容,IE8+
1306+
if (global.XDomainRequest) {
1307+
xhr = new global.XDomainRequest();
1308+
}
1309+
13061310
xhr.open(method, url);
13071311

13081312
xhr.onload = function (data) {

dist/AV.realtime.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/realtime.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* @author wangxiao
3-
* @date 2015-05-25
4-
* @homepage http://github.com/leancloud/js-realtime-sdk/
2+
* @author wangxiao liye
3+
* @see http://github.com/leancloud/js-realtime-sdk/
54
*
65
* 每位工程师都有保持代码优雅的义务
76
* Each engineer has a duty to keep the code elegant

lib/tool/ajax.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ module.exports = function (options, callback) {
1010
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
1111
var xhr = new XMLHttpRequest();
1212

13+
// 浏览器兼容,IE8+
14+
if (global.XDomainRequest) {
15+
xhr = new global.XDomainRequest();
16+
}
17+
1318
xhr.open(method, url);
1419

1520
xhr.onload = function (data) {

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
},
2525
"homepage": "https://leancloud.cn/",
2626
"devDependencies": {
27-
"es6-promise": "^2.3.0",
27+
"es6-promise": "^3",
2828
"grunt": "^0.4.5",
29-
"grunt-babel": "^5.0.1",
30-
"grunt-browserify": "^3.8.0",
31-
"grunt-contrib-connect": "^0.10.1",
29+
"grunt-babel": "^5.0",
30+
"grunt-browserify": "^4.0",
31+
"grunt-contrib-connect": "^0.11",
3232
"grunt-contrib-jshint": "^0.11.2",
3333
"grunt-contrib-uglify": "^0.9.1",
3434
"grunt-contrib-watch": "^0.6.1",
35-
"grunt-jscs": "^1.8.0",
36-
"grunt-mocha-phantomjs": "^0.7.0",
35+
"grunt-jscs": "^2.1",
36+
"grunt-mocha-phantomjs": "^2.0",
3737
"grunt-saucelabs": "^8.6.1",
3838
"grunt-simple-mocha": "^0.4.0",
3939
"load-grunt-tasks": "^3.2.0",
@@ -42,8 +42,8 @@
4242
"sinon": "^1.15.4"
4343
},
4444
"dependencies": {
45-
"ws": "^0.7.2",
46-
"xmlhttprequest": "^1.7.0"
45+
"ws": "^0.8",
46+
"xmlhttprequest": "^1.8"
4747
},
4848
"browser": {
4949
"xmlhttprequest": "./src/tool/xmlhttprequest4browser.js"

src/realtime.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* @author wangxiao
3-
* @date 2015-05-25
4-
* @homepage http://github.com/leancloud/js-realtime-sdk/
2+
* @author wangxiao liye
3+
* @see http://github.com/leancloud/js-realtime-sdk/
54
*
65
* 每位工程师都有保持代码优雅的义务
76
* Each engineer has a duty to keep the code elegant

src/tool/ajax.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ module.exports = function(options, callback) {
1010
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
1111
var xhr = new XMLHttpRequest();
1212

13+
// 浏览器兼容,IE8+
14+
if (global.XDomainRequest) {
15+
xhr = new global.XDomainRequest();
16+
}
17+
1318
xhr.open(method, url);
1419

1520
xhr.onload = function(data) {

test/specs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var sinon = require('sinon');
88
require('should-sinon');
99

1010
// 请将 AppId 改为你自己的 AppId
11-
var appId = '9p6hyhh60av3ukkni3i9z53q1l8yy3cijj6sie3cewft18vm';
11+
var appId = 'anruhhk6visejjip57psvv5uuv8sggrzdfl9pg2bghgsiy35';
1212

1313
var convName = 'js-realtime-sdk-testconv';
1414

@@ -139,7 +139,7 @@ describe('RealtimeObject', function() {
139139
}).should.throw();
140140
});
141141
it('fetch an exsiting room', function(done) {
142-
rt.room('55a8d0d3e4b0ffa2f8a9a1bd', function(room) {
142+
rt.room('559d08a1e4b0a35bc5062ba1', function(room) {
143143
room.should.have.properties(['id', 'name', 'attr']);
144144
done();
145145
});

0 commit comments

Comments
 (0)