mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add requireWithGlobals() to atom global
This commit is contained in:
@@ -123,20 +123,8 @@ window.deserialize = (args...) ->
|
||||
atom.deserializers.deserialize(args...)
|
||||
window.getDeserializer = (args...) ->
|
||||
atom.deserializer.getDeserializer(args...)
|
||||
|
||||
window.requireWithGlobals = (id, globals={}) ->
|
||||
existingGlobals = {}
|
||||
for key, value of globals
|
||||
existingGlobals[key] = window[key]
|
||||
window[key] = value
|
||||
|
||||
require(id)
|
||||
|
||||
for key, value of existingGlobals
|
||||
if value is undefined
|
||||
delete window[key]
|
||||
else
|
||||
window[key] = value
|
||||
window.requireWithGlobals = (args...) ->
|
||||
atom.requireWithGlobals(args...)
|
||||
|
||||
window.measure = (description, fn) ->
|
||||
start = new Date().getTime()
|
||||
|
||||
Reference in New Issue
Block a user