remote.require should return the same object for the same module.
This is required to use jasmine to test methods of the remote module.
This commit is contained in:
parent
2f9c30dd50
commit
620c9fa109
2 changed files with 15 additions and 1 deletions
|
@ -87,9 +87,14 @@ window.addEventListener 'unload', (event) ->
|
|||
ipc.sendChannelSync 'ATOM_BROWSER_RELEASE_RENDER_VIEW'
|
||||
|
||||
# Get remote module.
|
||||
# (Just like node's require, the modules are cached permanently, note that this
|
||||
# is safe leak since the object is not expected to get freed in browser)
|
||||
moduleCache = {}
|
||||
exports.require = (module) ->
|
||||
return moduleCache[module] if moduleCache[module]?
|
||||
|
||||
meta = ipc.sendChannelSync 'ATOM_BROWSER_REQUIRE', module
|
||||
metaToValue meta
|
||||
moduleCache[module] = metaToValue meta
|
||||
|
||||
# Get object with specified id.
|
||||
exports.getObject = (id) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue