Skip to content

Commit

Permalink
Merge pull request #157 from wangxiao/master
Browse files Browse the repository at this point in the history
[bugfix] 兼容 IE8+,发布 2.3.0
  • Loading branch information
wangxiao committed Oct 15, 2015
2 parents 446817c + 520e6cb commit c02b647
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 21 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
node_js:
- "0.12"
- "4"
sudo: false
before_install:
- npm install bower grunt-cli -g
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
## 贡献
如果你希望为这个项目贡献代码,请按以下步骤进行:
* fork 这个项目
* `grunt dev` 在本地进行调试
* 在目录中执行 `npm install` 安装所需 node 依赖包
* 在目录中执行 `bower install` 安装所需 Web 依赖库
* 执行 `grunt dev` 浏览器打开 http://localhost:8000 本地进行调试
* 修改 `src` 目录中的源码,系统会自动生成调试代码
* `grunt release` 打包生成 dist
* 确保 `grunt test` 的测试全部 pass
* 提交并发起 PR

其他说明:`grunt dev` 会监听每次 `src` 目录中的改动,自动进行 `grunt release` 打包操作,不需要再手动执行一次。

项目的目录结构说明如下:
```
.
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.3.0
### Features
* 增加 `invited`, `kicked`, `membersjoined`, `membersleft` 事件,废弃 `join`, `left` 事件

### Bug Fixes
* 修复 IE8、IE9 无法连接服务器的 bug
* 修复没有加入的 conversation 无法查询成员的 bug

## 2.2.1
### Features
* 内置 [ws](https://www.npmjs.com/package/ws) 作为默认 WebSocket 实现,在 node 运行环境中使用时不再要求配置 WebSocket 类。
Expand Down
10 changes: 7 additions & 3 deletions dist/AV.realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ AV.realtime = require('./realtime');
},{"./realtime":2}],2:[function(require,module,exports){
(function (global){
/**
* @author wangxiao
* @date 2015-05-25
* @homepage http://github.com/leancloud/js-realtime-sdk/
* @author wangxiao liye
* @see http://github.com/leancloud/js-realtime-sdk/
*
* 每位工程师都有保持代码优雅的义务
* Each engineer has a duty to keep the code elegant
Expand Down Expand Up @@ -1303,6 +1302,11 @@ module.exports = function (options, callback) {
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();

// 浏览器兼容,IE8+
if (global.XDomainRequest) {
xhr = new global.XDomainRequest();
}

xhr.open(method, url);

xhr.onload = function (data) {
Expand Down
2 changes: 1 addition & 1 deletion dist/AV.realtime.min.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions lib/realtime.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* @author wangxiao
* @date 2015-05-25
* @homepage http://github.com/leancloud/js-realtime-sdk/
* @author wangxiao liye
* @see http://github.com/leancloud/js-realtime-sdk/
*
* 每位工程师都有保持代码优雅的义务
* Each engineer has a duty to keep the code elegant
Expand Down
5 changes: 5 additions & 0 deletions lib/tool/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ module.exports = function (options, callback) {
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();

// 浏览器兼容,IE8+
if (global.XDomainRequest) {
xhr = new global.XDomainRequest();
}

xhr.open(method, url);

xhr.onload = function (data) {
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
},
"homepage": "https://leancloud.cn/",
"devDependencies": {
"es6-promise": "^2.3.0",
"es6-promise": "^3",
"grunt": "^0.4.5",
"grunt-babel": "^5.0.1",
"grunt-browserify": "^3.8.0",
"grunt-contrib-connect": "^0.10.1",
"grunt-babel": "^5.0",
"grunt-browserify": "^4.0",
"grunt-contrib-connect": "^0.11",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-jscs": "^1.8.0",
"grunt-mocha-phantomjs": "^0.7.0",
"grunt-jscs": "^2.1",
"grunt-mocha-phantomjs": "^2.0",
"grunt-saucelabs": "^8.6.1",
"grunt-simple-mocha": "^0.4.0",
"load-grunt-tasks": "^3.2.0",
Expand All @@ -42,8 +42,8 @@
"sinon": "^1.15.4"
},
"dependencies": {
"ws": "^0.7.2",
"xmlhttprequest": "^1.7.0"
"ws": "^0.8",
"xmlhttprequest": "^1.8"
},
"browser": {
"xmlhttprequest": "./src/tool/xmlhttprequest4browser.js"
Expand Down
5 changes: 2 additions & 3 deletions src/realtime.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* @author wangxiao
* @date 2015-05-25
* @homepage http://github.com/leancloud/js-realtime-sdk/
* @author wangxiao liye
* @see http://github.com/leancloud/js-realtime-sdk/
*
* 每位工程师都有保持代码优雅的义务
* Each engineer has a duty to keep the code elegant
Expand Down
5 changes: 5 additions & 0 deletions src/tool/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ module.exports = function(options, callback) {
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();

// 浏览器兼容,IE8+
if (global.XDomainRequest) {
xhr = new global.XDomainRequest();
}

xhr.open(method, url);

xhr.onload = function(data) {
Expand Down
4 changes: 2 additions & 2 deletions test/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var sinon = require('sinon');
require('should-sinon');

// 请将 AppId 改为你自己的 AppId
var appId = '9p6hyhh60av3ukkni3i9z53q1l8yy3cijj6sie3cewft18vm';
var appId = 'anruhhk6visejjip57psvv5uuv8sggrzdfl9pg2bghgsiy35';

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

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('RealtimeObject', function() {
}).should.throw();
});
it('fetch an exsiting room', function(done) {
rt.room('55a8d0d3e4b0ffa2f8a9a1bd', function(room) {
rt.room('559d08a1e4b0a35bc5062ba1', function(room) {
room.should.have.properties(['id', 'name', 'attr']);
done();
});
Expand Down

0 comments on commit c02b647

Please sign in to comment.