diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index fc9ba12f0..48e237bd8 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -50,7 +50,7 @@ class DisplayBuffer @subscribe @buffer, 'markers-updated', @handleBufferMarkersUpdated @subscribe @buffer, 'marker-created', @handleBufferMarkerCreated - @state.on 'changed', ({key, newValue}) => + @subscribe @state, 'changed', ({key, newValue}) => switch key when 'softWrap' @trigger 'soft-wrap-changed', newValue diff --git a/src/edit-session.coffee b/src/edit-session.coffee index f06d7e066..70ccbf73a 100644 --- a/src/edit-session.coffee +++ b/src/edit-session.coffee @@ -73,7 +73,7 @@ class EditSession @addCursorAtBufferPosition(position) @languageMode = new LanguageMode(this, @buffer.getExtension()) - @state.on 'changed', ({key, newValue}) => + @subscribe @state, 'changed', ({key, newValue}) => switch key when 'scrollTop' @trigger 'scroll-top-changed', newValue diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 08076f1cf..0e0e98c49 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -25,7 +25,7 @@ class PaneContainer extends View else @state = site.createDocument(deserializer: 'PaneContainer') - @state.on 'changed', ({key, newValue, site}) => + @subscribe @state, 'changed', ({key, newValue, site}) => return if site is @state.site.id if key is 'root' if newValue? diff --git a/src/pane.coffee b/src/pane.coffee index f266944d7..a92e65c25 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -36,14 +36,14 @@ class Pane extends View deserializer: 'Pane' items: @items.map (item) -> item.getState?() ? item.serialize() - @state.get('items').on 'changed', ({index, removed, inserted, site}) => + @subscribe @state.get('items'), 'changed', ({index, removed, inserted, site}) => return if site is @state.site.id for itemState in removed @removeItemAtIndex(index, updateState: false) for itemState, i in inserted @addItem(deserialize(itemState), index + i, updateState: false) - @state.on 'changed', ({key, newValue, site}) => + @subscribe @state, 'changed', ({key, newValue, site}) => return if site is @state.site.id @showItemForUri(newValue) if key is 'activeItemUri'