mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Remove Model subclassing from PaneContainer
This commit is contained in:
@@ -6,19 +6,18 @@ ItemRegistry = require './item-registry'
|
||||
PaneContainerElement = require './pane-container-element'
|
||||
|
||||
module.exports =
|
||||
class PaneContainer extends Model
|
||||
class PaneContainer
|
||||
serializationVersion: 1
|
||||
root: null
|
||||
stoppedChangingActivePaneItemDelay: 100
|
||||
stoppedChangingActivePaneItemTimeout: null
|
||||
|
||||
constructor: (params) ->
|
||||
super
|
||||
|
||||
{@config, applicationDelegate, notificationManager, deserializerManager, @viewRegistry, @location} = params
|
||||
@emitter = new Emitter
|
||||
@subscriptions = new CompositeDisposable
|
||||
@itemRegistry = new ItemRegistry
|
||||
@alive = true
|
||||
|
||||
@setRoot(new Pane({container: this, @config, applicationDelegate, notificationManager, deserializerManager, @viewRegistry}))
|
||||
@setActivePane(@getRoot())
|
||||
@@ -32,6 +31,17 @@ class PaneContainer extends Model
|
||||
getElement: ->
|
||||
@element ?= new PaneContainerElement().initialize(this, {views: @viewRegistry})
|
||||
|
||||
destroy: ->
|
||||
@alive = false
|
||||
@cancelStoppedChangingActivePaneItemTimeout()
|
||||
pane.destroy() for pane in @getRoot().getPanes()
|
||||
@subscriptions.dispose()
|
||||
@emitter.dispose()
|
||||
|
||||
isAlive: -> @alive
|
||||
|
||||
isDestroyed: -> not @isAlive()
|
||||
|
||||
serialize: (params) ->
|
||||
deserializer: 'PaneContainer'
|
||||
version: @serializationVersion
|
||||
@@ -206,13 +216,6 @@ class PaneContainer extends Model
|
||||
didDestroyPane: (event) ->
|
||||
@emitter.emit 'did-destroy-pane', event
|
||||
|
||||
# Called by Model superclass when destroyed
|
||||
destroyed: ->
|
||||
@cancelStoppedChangingActivePaneItemTimeout()
|
||||
pane.destroy() for pane in @getRoot().getPanes()
|
||||
@subscriptions.dispose()
|
||||
@emitter.dispose()
|
||||
|
||||
cancelStoppedChangingActivePaneItemTimeout: ->
|
||||
if @stoppedChangingActivePaneItemTimeout?
|
||||
clearTimeout(@stoppedChangingActivePaneItemTimeout)
|
||||
|
||||
Reference in New Issue
Block a user