Don't load remote properties until they are accessed
This commit is contained in:
Родитель
f792c720f4
Коммит
eef42770c6
|
@ -167,6 +167,11 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
|
|||
}
|
||||
|
||||
return new Proxy(remoteMemberFunction, {
|
||||
set: (target, property, value, receiver) => {
|
||||
if (property !== 'ref') loadRemoteProperties()
|
||||
target[property] = value
|
||||
return true
|
||||
},
|
||||
get: (target, property, receiver) => {
|
||||
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
||||
return target[property]
|
||||
|
|
|
@ -72,7 +72,7 @@ describe('ipc module', function () {
|
|||
|
||||
a = remote.require(path.join(fixtures, 'module', 'function-with-missing-properties.js')).setup()
|
||||
assert.equal(a.bar(), true)
|
||||
assert.equal(typeof a.bar.baz, 'function')
|
||||
assert.equal(a.bar.baz, undefined)
|
||||
})
|
||||
|
||||
it('should work with static class members', function () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче