diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 5f60a970ff3a..30341c0f77b7 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -109,9 +109,16 @@ let setObjectMembers = function (object, metaId, members) { return metaToValue(ret) } } - descriptor.writable = true + descriptor.get = function () { + remoteMemberFunction.ref = object // The member should reference its object. + return remoteMemberFunction + } + // Enable monkey-patch the method + descriptor.set = function (value) { + remoteMemberFunction = value + return value + } descriptor.configurable = true - descriptor.value = remoteMemberFunction } else if (member.type === 'get') { descriptor.get = function () { return metaToValue(ipcRenderer.sendSync('ATOM_BROWSER_MEMBER_GET', metaId, member.name))