Skip to content

Commit

Permalink
Update to v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Apr 24, 2018
1 parent 3328515 commit 3fe106d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ build/Release
# Dependency directories
node_modules
jspm_packages
package-lock.json

# Optional npm cache directory
.npm
Expand Down
5 changes: 2 additions & 3 deletions dist/hprose.js

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions dist/hprose.src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Hprose for WeChat App v2.0.2
// Hprose for WeChat App v2.0.3
// Copyright (c) 2008-2016 http://hprose.com
// Hprose is freely distributable under the MIT license.
// For all details and documentation:
Expand Down Expand Up @@ -3453,11 +3453,12 @@ hprose.RawWithEndTag = hprose.ResultMode.RawWithEndTag;
* *
* hprose client for WeChat App. *
* *
* LastModified: Feb 6, 2018 *
* LastModified: Apr 24, 2018 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/

/* global Proxy */
(function (hprose, undefined) {
'use strict';
var setImmediate = hprose.setImmediate;
Expand All @@ -3481,6 +3482,29 @@ hprose.RawWithEndTag = hprose.ResultMode.RawWithEndTag;
var s_function = 'function';
var s_object = 'object';

function HproseProxy(setFunction, ns) {
var settings = {};
this.get = function(target, prop/*, receiver*/) {
var name = prop.toString();
if (ns) { name = ns + '_' + name; }
if (name === 'then') { return undefined; }
if (!target.hasOwnProperty(name)) {
settings[name] = {};
var handler = new HproseProxy(setFunction, name);
var func = setFunction(settings, name);
handler.apply = function(target, thisArg, argumentsList) {
return func.apply(null, argumentsList);
}
handler.set = function(target, prop, value/*, receiver*/) {
settings[name][prop] = value;
return true;
};
target[name] = new Proxy(function() {}, handler);
}
return target[name];
};
}

function Client(uri, functions, settings) {

// private members
Expand Down Expand Up @@ -4304,7 +4328,12 @@ hprose.RawWithEndTag = hprose.ResultMode.RawWithEndTag;
setImmediate(initService, stub);
return _ready;
}
setFunctions(stub, functions);
else if (typeof(Proxy) === 'undefined') {
setFunctions(stub, functions);
}
else {
stub = new Proxy({}, new HproseProxy(setFunction));
}
_ready.resolve(stub);
return stub;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/regenerator-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 31 additions & 2 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
* *
* hprose client for WeChat App. *
* *
* LastModified: Feb 6, 2018 *
* LastModified: Apr 24, 2018 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/

/* global Proxy */
(function (hprose, undefined) {
'use strict';
var setImmediate = hprose.setImmediate;
Expand All @@ -40,6 +41,29 @@
var s_function = 'function';
var s_object = 'object';

function HproseProxy(setFunction, ns) {
var settings = {};
this.get = function(target, prop/*, receiver*/) {
var name = prop.toString();
if (ns) { name = ns + '_' + name; }
if (name === 'then') { return undefined; }
if (!target.hasOwnProperty(name)) {
settings[name] = {};
var handler = new HproseProxy(setFunction, name);
var func = setFunction(settings, name);
handler.apply = function(target, thisArg, argumentsList) {
return func.apply(null, argumentsList);
}
handler.set = function(target, prop, value/*, receiver*/) {
settings[name][prop] = value;
return true;
};
target[name] = new Proxy(function() {}, handler);
}
return target[name];
};
}

function Client(uri, functions, settings) {

// private members
Expand Down Expand Up @@ -863,7 +887,12 @@
setImmediate(initService, stub);
return _ready;
}
setFunctions(stub, functions);
else if (typeof(Proxy) === 'undefined') {
setFunctions(stub, functions);
}
else {
stub = new Proxy({}, new HproseProxy(setFunction));
}
_ready.resolve(stub);
return stub;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CopyRight.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Hprose for WeChat App v2.0.2
// Hprose for WeChat App v2.0.3
// Copyright (c) 2008-2016 http://hprose.com
// Hprose is freely distributable under the MIT license.
// For all details and documentation:
Expand Down

0 comments on commit 3fe106d

Please sign in to comment.