Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
wk3368 committed Sep 12, 2017
2 parents e4f87e1 + 6577907 commit ba49fbc
Show file tree
Hide file tree
Showing 5 changed files with 922 additions and 56 deletions.
2 changes: 1 addition & 1 deletion demo/javascript/dist/webim.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WebIM.config = {
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
* false: A visitor can sign in to only one webpage and receive messages at the webpage.
*/
isMultiLoginSessions: false,
isMultiLoginSessions: true,
/*
* set presence after login
*/
Expand Down
52 changes: 1 addition & 51 deletions demo/javascript/src/components/sign/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,6 @@ module.exports = React.createClass({
};
},

validTabs: function () {
if (!WebIM.config.isMultiLoginSessions || !window.localStorage) {
return true;
} else {
Demo.userTimestamp = new Date().getTime();

var key = 'easemob_' + Demo.user;
var val = window.localStorage.getItem(key);
var count = 0;
var oneMinute = 60 * 1000;

if (val === undefined || val === '' || val === null) {
val = 'last';
}
val = Demo.userTimestamp + ',' + val;
var timestampArr = val.split(',');
var uniqueTimestampArr = [];
// Unique

for (var o in timestampArr) {
if (timestampArr[o] === 'last')
continue;
uniqueTimestampArr[timestampArr[o]] = 1;
}

val = 'last';
for (var o in uniqueTimestampArr) {
// if more than one minute, cut it
if (parseInt(o) + oneMinute < Demo.userTimestamp) {
continue;
}
count++;
if (count > this.state.pageLimit) {
return false;
}
val = o + ',' + val;
}
window.localStorage.setItem(key, val);
return true;
}
},

keyDown: function (e) {
if (e && e.keyCode === 13) {
this.login();
Expand Down Expand Up @@ -137,15 +95,7 @@ module.exports = React.createClass({
Demo.api.NotifyError('open:' + code + " - " + msg);
});
} else {
if (this.validTabs() === true) {
Demo.conn.open(options);
}
else {
Demo.conn.onError({
type: "One account can't open more than " + this.state.pageLimit + ' pages in one minute on the same browser'
});
return;
}
Demo.conn.open(options);
}
},

Expand Down
3 changes: 3 additions & 0 deletions sdk/jsdoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

rm -rf jsdoc/out
jsdoc src/connection.js -c jsdoc/conf.json

#npm install -g jsdoc-to-markdown
#jsdoc2md ./src/connection.js > ./jsdoc/out.md
Loading

0 comments on commit ba49fbc

Please sign in to comment.