-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
@@ -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; | ||
|
@@ -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 | ||
|
@@ -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; | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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 | ||
|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters