Skip to content

Commit

Permalink
Removed eval
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Nov 18, 2016
1 parent fcdc7a8 commit 307d2b4
Show file tree
Hide file tree
Showing 27 changed files with 385 additions and 379 deletions.
6 changes: 3 additions & 3 deletions dist/hprose-html5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hprose-html5.min.js

Large diffs are not rendered by default.

377 changes: 190 additions & 187 deletions dist/hprose-html5.src.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Expand Up @@ -34,9 +34,9 @@ gulp.task('concat', ['clear'], function() {
'src/TcpClient.js',
'src/JSONRPCClientFilter.js',
'src/Loader.js'])
.pipe(concat('hprose-html5.src.js'))
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(concat('hprose-html5.src.js'))
.pipe(gulp.dest('dist'));
});

Expand Down
14 changes: 7 additions & 7 deletions src/APICloudTcpSocket.js
Expand Up @@ -12,19 +12,19 @@
* *
* APICloud tcp socket for HTML5. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, global, undefined) {
'use strict';

var Future = global.hprose.Future;
var Future = hprose.Future;
var atob = global.atob;
var btoa = global.btoa;
var toUint8Array = global.hprose.toUint8Array;
var toBinaryString = global.hprose.toBinaryString;
var toUint8Array = hprose.toUint8Array;
var toBinaryString = hprose.toBinaryString;

function noop(){}

Expand Down Expand Up @@ -127,6 +127,6 @@
} }
});

global.hprose.APICloudTcpSocket = APICloudTcpSocket;
hprose.APICloudTcpSocket = APICloudTcpSocket;

})(this || [eval][0]('this'));
})(hprose, hprose.global);
4 changes: 2 additions & 2 deletions src/Base64.js
Expand Up @@ -12,7 +12,7 @@
* *
* Base64 for HTML5. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
Expand Down Expand Up @@ -131,4 +131,4 @@
})();
}

})(this || [eval][0]('this'));
})(hprose.global);
10 changes: 5 additions & 5 deletions src/BytesIO.js
Expand Up @@ -13,15 +13,15 @@
* *
* hprose BytesIO for HTML5. *
* *
* LastModified: Oct 23, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, undefined) {
'use strict';

var toBinaryString = global.hprose.toBinaryString;
var toBinaryString = hprose.toBinaryString;

var _EMPTY_BYTES = new Uint8Array(0);
var _INIT_SIZE = 1024;
Expand Down Expand Up @@ -594,6 +594,6 @@

Object.defineProperty(BytesIO, 'toString', { value: toString });

global.hprose.BytesIO = BytesIO;
hprose.BytesIO = BytesIO;

})(this || [eval][0]('this'));
})(hprose);
10 changes: 5 additions & 5 deletions src/ChromeTcpSocket.js
Expand Up @@ -12,15 +12,15 @@
* *
* chrome tcp socket for JavaScript. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, global, undefined) {
'use strict';

var Future = global.hprose.Future;
var Future = hprose.Future;

function noop(){}

Expand Down Expand Up @@ -176,6 +176,6 @@
} }
});

global.hprose.ChromeTcpSocket = ChromeTcpSocket;
hprose.ChromeTcpSocket = ChromeTcpSocket;

})(this || [eval][0]('this'));
})(hprose, hprose.global);
10 changes: 5 additions & 5 deletions src/ClassManager.js
Expand Up @@ -13,12 +13,12 @@
* *
* hprose ClassManager for HTML5. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global) {
(function (hprose, global) {
'use strict';

var WeakMap = global.WeakMap;
Expand All @@ -39,14 +39,14 @@
return classCache[alias];
}

global.hprose.ClassManager = Object.create(null, {
hprose.ClassManager = Object.create(null, {
register: { value: register },
getClassAlias: { value: getClassAlias },
getClass: { value: getClass }
});

global.hprose.register = register;
hprose.register = register;

register(Object, 'Object');

})(this || [eval][0]('this'));
})(hprose, hprose.global);
30 changes: 15 additions & 15 deletions src/Client.js
Expand Up @@ -12,23 +12,23 @@
* *
* hprose client for HTML5. *
* *
* LastModified: Nov 14, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, global, undefined) {
'use strict';

var setImmediate = global.setImmediate;
var Tags = global.hprose.Tags;
var ResultMode = global.hprose.ResultMode;
var BytesIO = global.hprose.BytesIO;
var Writer = global.hprose.Writer;
var Reader = global.hprose.Reader;
var Future = global.hprose.Future;
var parseuri = global.hprose.parseuri;
var isObjectEmpty = global.hprose.isObjectEmpty;
var Tags = hprose.Tags;
var ResultMode = hprose.ResultMode;
var BytesIO = hprose.BytesIO;
var Writer = hprose.Writer;
var Reader = hprose.Reader;
var Future = hprose.Future;
var parseuri = hprose.parseuri;
var isObjectEmpty = hprose.isObjectEmpty;

var GETFUNCTIONS = new Uint8Array(1);
GETFUNCTIONS[0] = Tags.TagEnd;
Expand Down Expand Up @@ -1183,15 +1183,15 @@

function create(uri, functions, settings) {
try {
return global.hprose.HttpClient.create(uri, functions, settings);
return hprose.HttpClient.create(uri, functions, settings);
}
catch(e) {}
try {
return global.hprose.TcpClient.create(uri, functions, settings);
return hprose.TcpClient.create(uri, functions, settings);
}
catch(e) {}
try {
return global.hprose.WebSocketClient.create(uri, functions, settings);
return hprose.WebSocketClient.create(uri, functions, settings);
}
catch(e) {}
if (typeof uri === 'string') {
Expand All @@ -1206,6 +1206,6 @@

Object.defineProperty(Client, 'create', { value: create });

global.hprose.Client = Client;
hprose.Client = Client;

})(this || [eval][0]('this'));
})(hprose, hprose.global);
18 changes: 9 additions & 9 deletions src/Formatter.js
Expand Up @@ -13,17 +13,17 @@
* *
* hprose Formatter for HTML5. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global) {
(function (hprose) {
'use strict';

var BytesIO = global.hprose.BytesIO;
var Writer = global.hprose.Writer;
var Reader = global.hprose.Reader;
var BytesIO = hprose.BytesIO;
var Writer = hprose.Writer;
var Reader = hprose.Reader;

function serialize(value, simple) {
var stream = new BytesIO();
Expand All @@ -39,15 +39,15 @@
return new Reader(stream, simple, useHarmonyMap).unserialize();
}

global.hprose.Formatter = {
hprose.Formatter = {
serialize: function (value, simple) {
return serialize(value, simple).bytes;
},
unserialize: unserialize
};

global.hprose.serialize = serialize;
hprose.serialize = serialize;

global.hprose.unserialize = unserialize;
hprose.unserialize = unserialize;

})(this || [eval][0]('this'));
})(hprose);
34 changes: 18 additions & 16 deletions src/Future.js
Expand Up @@ -18,7 +18,7 @@
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, global, undefined) {
'use strict';

var PENDING = 0;
Expand Down Expand Up @@ -817,12 +817,12 @@
} }
});

global.hprose.Future = Future;
hprose.Future = Future;

global.hprose.thunkify = thunkify;
global.hprose.promisify = promisify;
global.hprose.co = co;
global.hprose.co.wrap = global.hprose.wrap = wrap;
hprose.thunkify = thunkify;
hprose.promisify = promisify;
hprose.co = co;
hprose.co.wrap = hprose.wrap = wrap;

function Completer() {
var future = new Future();
Expand All @@ -836,13 +836,13 @@
});
}

global.hprose.Completer = Completer;
hprose.Completer = Completer;

global.hprose.resolved = value;
hprose.resolved = value;

global.hprose.rejected = error;
hprose.rejected = error;

global.hprose.deferred = function() {
hprose.deferred = function() {
var self = new Future();
return Object.create(null, {
promise: { value: self },
Expand All @@ -853,19 +853,21 @@

if (hasPromise) { return; }

global.Promise = function(executor) {
function MyPromise(executor) {
Future.call(this);
executor(this.resolve, this.reject);
};
}

global.Promise.prototype = Object.create(Future.prototype);
global.Promise.prototype.constructor = Future;
MyPromise.prototype = Object.create(Future.prototype);
MyPromise.prototype.constructor = Future;

Object.defineProperties(global.Promise, {
Object.defineProperties(MyPromise, {
all: { value: all },
race: { value: race },
resolve: { value: value },
reject: { value: error }
});

})(this || [eval][0]('this'));
global.Promise = MyPromise;

})(hprose, hprose.global);
4 changes: 2 additions & 2 deletions src/HarmonyMaps.js
Expand Up @@ -13,7 +13,7 @@
* *
* Harmony Maps for HTML5. *
* *
* LastModified: Sep 29, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
Expand Down Expand Up @@ -297,4 +297,4 @@
return m;
};
}
})(this || [eval][0]('this'));
})(hprose.global);
18 changes: 9 additions & 9 deletions src/Helper.js
Expand Up @@ -13,12 +13,12 @@
* *
* hprose helper for HTML5. *
* *
* LastModified: Oct 12, 2016 *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/

(function (global, undefined) {
(function (hprose, undefined) {
'use strict';

function generic(method) {
Expand Down Expand Up @@ -104,11 +104,11 @@
return true;
}

global.hprose.generic = generic;
global.hprose.toBinaryString = toBinaryString;
global.hprose.toUint8Array = toUint8Array;
global.hprose.toArray = toArray;
global.hprose.parseuri = parseuri;
global.hprose.isObjectEmpty = isObjectEmpty;
hprose.generic = generic;
hprose.toBinaryString = toBinaryString;
hprose.toUint8Array = toUint8Array;
hprose.toArray = toArray;
hprose.parseuri = parseuri;
hprose.isObjectEmpty = isObjectEmpty;

})(this || [eval][0]('this'));
})(hprose);

0 comments on commit 307d2b4

Please sign in to comment.