Check deprecations flag for space pen shim inclusion

This commit is contained in:
Kevin Sawicki
2015-03-25 17:31:28 -07:00
parent dd72bbe0ef
commit 0c06c69cd9
2 changed files with 11 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
{CompositeDisposable} = require 'event-kit'
Grim = require 'grim'
{callAttachHooks} = require './space-pen-extensions'
PaneContainerView = null
_ = require 'underscore-plus'
@@ -8,12 +9,14 @@ class PaneContainerElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
@classList.add 'panes'
PaneContainerView ?= require './pane-container-view'
@__spacePenView = new PaneContainerView(this)
if Grim.includeDeprecations
PaneContainerView ?= require './pane-container-view'
@__spacePenView = new PaneContainerView(this)
initialize: (@model) ->
@subscriptions.add @model.observeRoot(@rootChanged.bind(this))
@__spacePenView.setModel(@model)
@__spacePenView.setModel(@model) if Grim.includeDeprecations
this
rootChanged: (root) ->

View File

@@ -1,6 +1,7 @@
{CompositeDisposable} = require 'event-kit'
Grim = require 'grim'
{$, callAttachHooks, callRemoveHooks} = require './space-pen-extensions'
PaneView = require './pane-view'
PaneView = null
class PaneElement extends HTMLElement
attached: false
@@ -12,7 +13,7 @@ class PaneElement extends HTMLElement
@initializeContent()
@subscribeToDOMEvents()
@createSpacePenShim()
@createSpacePenShim() if Grim.includeDeprecations
attachedCallback: ->
@attached = true
@@ -41,6 +42,7 @@ class PaneElement extends HTMLElement
@addEventListener 'blur', handleBlur, true
createSpacePenShim: ->
PaneView ?= require './pane-view'
@__spacePenView = new PaneView(this)
initialize: (@model) ->
@@ -49,7 +51,7 @@ class PaneElement extends HTMLElement
@subscriptions.add @model.observeActiveItem(@activeItemChanged.bind(this))
@subscriptions.add @model.onDidRemoveItem(@itemRemoved.bind(this))
@subscriptions.add @model.onDidDestroy(@paneDestroyed.bind(this))
@__spacePenView.setModel(@model)
@__spacePenView.setModel(@model) if Grim.includeDeprecations
this
getModel: -> @model