🐛 Add toString support to remote functions

This commit is contained in:
Todd Wolfson 2017-03-17 08:21:37 -07:00
parent 85d66d2413
commit 818738ce84
2 changed files with 8 additions and 0 deletions

View file

@ -175,6 +175,9 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
return true
},
get: (target, property, receiver) => {
if (property === 'toString' && typeof target.toString === 'function') {
return target.toString.bind(target)
}
if (!target.hasOwnProperty(property)) loadRemoteProperties()
return target[property]
},

View file

@ -161,6 +161,11 @@ describe('ipc module', function () {
assert.equal(typeof remote.clipboard.readText, '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 () {