Skip to content

Commit 4900fb0

Browse files
committed
Update to 1.5.4
Rewrite the Hprose Future to be compatible with Promises/A+. Added trunc method for BytesIO. Removed hprose.Exception. Added returning Serialized data in batch mode support.
1 parent 0c833a3 commit 4900fb0

File tree

15 files changed

+476
-272
lines changed

15 files changed

+476
-272
lines changed

bower.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
{
22
"author": "Ma Bingyao <andot@hprose.com>",
33
"name": "hprose-html5",
4-
"version": "1.5.3",
4+
"version": "1.5.4",
55
"description": "Hprose is a High Performance Remote Object Service Engine. It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware.",
66
"keywords": [
77
"hprose",
8-
"serialize",
9-
"serialization",
108
"rpc",
119
"webservice",
10+
"websocket",
11+
"http",
12+
"ajax",
13+
"json",
14+
"jsonrpc",
15+
"cross-language",
16+
"cross-platform",
17+
"cross-domain",
18+
"html5",
19+
"serialize",
20+
"serialization",
21+
"protocol",
1222
"web",
1323
"service",
1424
"framework",
1525
"library",
1626
"game",
17-
"cross-platform",
18-
"cross-language",
1927
"communication",
20-
"middleware"
28+
"middleware",
29+
"webapi",
30+
"async",
31+
"future"
2132
],
2233
"homepage": "http://hprose.com",
2334
"repository": {
@@ -31,4 +42,4 @@
3142
"test", "src", "*.md"
3243
],
3344
"license": "MIT"
34-
}
45+
}

dist/hprose-html5.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
{
22
"name": "hprose-html5",
33
"filename": "hprose-html5.js",
4-
"version": "1.5.3",
4+
"version": "1.5.4",
55
"description": "Hprose is a High Performance Remote Object Service Engine. It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.",
66
"homepage": "https://github.com/andot/hprose",
77
"keywords": [
8-
"hprose", "rpc", "webservice", "websocket", "http", "ajax", "json", "jsonrpc", "cross-language", "cross-platform", "cross-domain", "html5", "serialize", "serialization","protocol", "web", "service", "framework",
9-
"library", "game", "communication", "middleware"
8+
"hprose",
9+
"rpc",
10+
"webservice",
11+
"websocket",
12+
"http",
13+
"ajax",
14+
"json",
15+
"jsonrpc",
16+
"cross-language",
17+
"cross-platform",
18+
"cross-domain",
19+
"html5",
20+
"serialize",
21+
"serialization",
22+
"protocol",
23+
"web",
24+
"service",
25+
"framework",
26+
"library",
27+
"game",
28+
"communication",
29+
"middleware",
30+
"webapi",
31+
"async",
32+
"future"
1033
],
1134
"maintainers": [
1235
{

src/BytesIO.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@
1313
* *
1414
* hprose BytesIO for HTML5. *
1515
* *
16-
* LastModified: May 21, 2015 *
16+
* LastModified: Jun 22, 2015 *
1717
* Author: Ma Bingyao <andot@hprose.com> *
1818
* *
1919
\**********************************************************/
2020

2121
(function (global) {
2222
'use strict';
2323

24-
var Exception = global.hprose.Exception;
25-
2624
var _EMPTY_BYTES = new Uint8Array(0);
2725
var _INIT_SIZE = 1024;
2826

@@ -51,7 +49,7 @@
5149
(array[off++] & 0x3F);
5250
}
5351
else {
54-
throw new Exception('Unfinished UTF-8 octet sequence');
52+
throw new Error('Unfinished UTF-8 octet sequence');
5553
}
5654
break;
5755
case 14:
@@ -61,7 +59,7 @@
6159
(array[off++] & 0x3F);
6260
}
6361
else {
64-
throw new Exception('Unfinished UTF-8 octet sequence');
62+
throw new Error('Unfinished UTF-8 octet sequence');
6563
}
6664
break;
6765
case 15:
@@ -75,15 +73,15 @@
7573
charCodes[i] = ((rune & 0x03FF) | 0xDC00);
7674
}
7775
else {
78-
throw new Exception('Character outside valid Unicode range: 0x' + rune.toString(16));
76+
throw new Error('Character outside valid Unicode range: 0x' + rune.toString(16));
7977
}
8078
}
8179
else {
82-
throw new Exception('Unfinished UTF-8 octet sequence');
80+
throw new Error('Unfinished UTF-8 octet sequence');
8381
}
8482
break;
8583
default:
86-
throw new Exception('Bad UTF-8 encoding 0x' + unit.toString(16));
84+
throw new Error('Bad UTF-8 encoding 0x' + unit.toString(16));
8785
}
8886
}
8987
if (i < n) {
@@ -220,7 +218,7 @@
220218
continue;
221219
}
222220
}
223-
throw new Exception('Malformed string');
221+
throw new Error('Malformed string');
224222
}
225223
}
226224
}
@@ -325,6 +323,14 @@
325323
return new BytesIO(toBytes());
326324
}
327325

326+
function trunc() {
327+
_bytes = _bytes.subarray(_off, _length);
328+
_length = _bytes.length;
329+
_off = 0;
330+
_wmark = 0;
331+
_rmark = 0;
332+
}
333+
328334
/* function constructor() */ {
329335
var a = arguments;
330336
switch (a.length) {
@@ -364,7 +370,8 @@
364370
takeBytes: { value: takeBytes },
365371
toBytes: { value: toBytes },
366372
toString: { value: toString },
367-
clone: { value: clone }
373+
clone: { value: clone },
374+
trunc: { value: trunc }
368375
});
369376
}
370377

0 commit comments

Comments
 (0)