mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-26 08:03:17 +03:00
Add shim for atom.rootView vs. window.rootView
This commit is contained in:
parent
37a5a6f501
commit
8e46bc5241
@ -216,14 +216,18 @@ class AtomPackage extends Package
|
||||
@activateStylesheets()
|
||||
@requireMainModule()
|
||||
|
||||
# Private: TODO remove once packages have been updated
|
||||
getRootView: ->
|
||||
atom?.rootView ? window.rootView
|
||||
|
||||
subscribeToActivationEvents: ->
|
||||
return unless @metadata.activationEvents?
|
||||
if _.isArray(@metadata.activationEvents)
|
||||
atom.rootView.command(event, @handleActivationEvent) for event in @metadata.activationEvents
|
||||
@getRootView().command(event, @handleActivationEvent) for event in @metadata.activationEvents
|
||||
else if _.isString(@metadata.activationEvents)
|
||||
atom.rootView.command(@metadata.activationEvents, @handleActivationEvent)
|
||||
@getRootView().command(@metadata.activationEvents, @handleActivationEvent)
|
||||
else
|
||||
atom.rootView.command(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
|
||||
@getRootView().command(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
|
||||
|
||||
handleActivationEvent: (event) =>
|
||||
bubblePathEventHandlers = @disableEventHandlersOnBubblePath(event)
|
||||
@ -234,11 +238,11 @@ class AtomPackage extends Package
|
||||
|
||||
unsubscribeFromActivationEvents: ->
|
||||
if _.isArray(@metadata.activationEvents)
|
||||
atom.rootView.off(event, @handleActivationEvent) for event in @metadata.activationEvents
|
||||
@getRootView().off(event, @handleActivationEvent) for event in @metadata.activationEvents
|
||||
else if _.isString(@metadata.activationEvents)
|
||||
atom.rootView.off(@metadata.activationEvents, @handleActivationEvent)
|
||||
@getRootView().off(@metadata.activationEvents, @handleActivationEvent)
|
||||
else
|
||||
atom.rootView.off(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
|
||||
@getRootView().off(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
|
||||
|
||||
disableEventHandlersOnBubblePath: (event) ->
|
||||
bubblePathEventHandlers = []
|
||||
|
Loading…
Reference in New Issue
Block a user