🐛 Add toString support to remote functions
This commit is contained in:
parent
85d66d2413
commit
818738ce84
2 changed files with 8 additions and 0 deletions
|
@ -175,6 +175,9 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
get: (target, property, receiver) => {
|
get: (target, property, receiver) => {
|
||||||
|
if (property === 'toString' && typeof target.toString === 'function') {
|
||||||
|
return target.toString.bind(target)
|
||||||
|
}
|
||||||
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
||||||
return target[property]
|
return target[property]
|
||||||
},
|
},
|
||||||
|
|
|
@ -161,6 +161,11 @@ describe('ipc module', function () {
|
||||||
assert.equal(typeof remote.clipboard.readText, 'function')
|
assert.equal(typeof remote.clipboard.readText, 'function')
|
||||||
assert.equal(typeof remote.shell.openExternal, 'function')
|
assert.equal(typeof remote.shell.openExternal, 'function')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('returns toString() of original function via toString()', function () {
|
||||||
|
var readText = remote.clipboard.readText
|
||||||
|
assert(readText.toString().startsWith('function'))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('remote object in renderer', function () {
|
describe('remote object in renderer', function () {
|
||||||
|
|
Loading…
Reference in a new issue