diff --git a/internal_packages/account-sidebar/lib/sidebar-store.coffee b/internal_packages/account-sidebar/lib/sidebar-store.coffee index 68d783ff3..c46614fd0 100644 --- a/internal_packages/account-sidebar/lib/sidebar-store.coffee +++ b/internal_packages/account-sidebar/lib/sidebar-store.coffee @@ -45,11 +45,11 @@ class SidebarStore extends NylasStore @listenTo ThreadCountsStore, @_updateSections @listenTo CategoryStore, @_updateSections - @configSubscription = NylasEnv.config.observe( + @configSubscription = NylasEnv.config.onDidChange( 'core.workspace.showUnreadForAllCategories', @_updateSections ) - @configSubscription = NylasEnv.config.observe( + @configSubscription = NylasEnv.config.onDidChange( 'core.accountSidebarCollapsed', @_updateSections ) diff --git a/internal_packages/message-autoload-images/lib/autoload-images-store.coffee b/internal_packages/message-autoload-images/lib/autoload-images-store.coffee index a3da9cf29..f2a1d71a3 100644 --- a/internal_packages/message-autoload-images/lib/autoload-images-store.coffee +++ b/internal_packages/message-autoload-images/lib/autoload-images-store.coffee @@ -23,7 +23,7 @@ class AutoloadImagesStore extends NylasStore @listenTo AutoloadImagesActions.temporarilyEnableImages, @_onTemporarilyEnableImages @listenTo AutoloadImagesActions.permanentlyEnableImages, @_onPermanentlyEnableImages - NylasEnv.config.observe 'core.reading.autoloadImages', => + NylasEnv.config.onDidChange 'core.reading.autoloadImages', => MessageBodyProcessor.resetCache() shouldBlockImagesIn: (message) => diff --git a/src/components/config-prop-container.cjsx b/src/components/config-prop-container.cjsx index 5e10b5250..825de123d 100644 --- a/src/components/config-prop-container.cjsx +++ b/src/components/config-prop-container.cjsx @@ -8,7 +8,7 @@ class ConfigPropContainer extends React.Component @state = @getStateFromStores() componentDidMount: => - @subscription = NylasEnv.config.observe null, (val) => + @subscription = NylasEnv.config.onDidChange null, => @setState(@getStateFromStores()) componentWillUnmount: => diff --git a/src/components/mail-important-icon.cjsx b/src/components/mail-important-icon.cjsx index b7e51b423..150a16c06 100644 --- a/src/components/mail-important-icon.cjsx +++ b/src/components/mail-important-icon.cjsx @@ -45,7 +45,7 @@ class MailImportantIcon extends React.Component componentDidMount: => @unsubscribe = FocusedPerspectiveStore.listen => @setState(@getState()) - @subscription = NylasEnv.config.observe ShowImportantKey, => + @subscription = NylasEnv.config.onDidChange ShowImportantKey, => @setState(@getState()) componentWillReceiveProps: (nextProps) => diff --git a/src/flux/stores/category-store.coffee b/src/flux/stores/category-store.coffee index ad3f31203..23b78a487 100644 --- a/src/flux/stores/category-store.coffee +++ b/src/flux/stores/category-store.coffee @@ -22,7 +22,7 @@ class CategoryStore extends NylasStore @_userCategories = {} @_hiddenCategories = {} - NylasEnv.config.observe 'core.workspace.showImportant', => + NylasEnv.config.onDidChange 'core.workspace.showImportant', => return unless @_categoryResult @_onCategoriesChanged(@_categoryResult) diff --git a/src/flux/stores/unread-badge-store.coffee b/src/flux/stores/unread-badge-store.coffee index 4b48f403e..ba4eb73a0 100644 --- a/src/flux/stores/unread-badge-store.coffee +++ b/src/flux/stores/unread-badge-store.coffee @@ -11,8 +11,8 @@ class UnreadBadgeStore extends NylasStore @listenTo FocusedPerspectiveStore, @_updateCount @listenTo ThreadCountsStore, @_updateCount - NylasEnv.config.observe 'core.notifications.unreadBadge', (val) => - if val is true + NylasEnv.config.onDidChange 'core.notifications.unreadBadge', ({newValue}) => + if newValue is true @_setBadgeForCount() else @_setBadge("") diff --git a/src/flux/stores/workspace-store.coffee b/src/flux/stores/workspace-store.coffee index 12393e7d4..a8025e66d 100644 --- a/src/flux/stores/workspace-store.coffee +++ b/src/flux/stores/workspace-store.coffee @@ -31,9 +31,9 @@ class WorkspaceStore extends NylasStore @listenTo Actions.focusMailboxPerspective, @popToRootSheet @_preferredLayoutMode = NylasEnv.config.get('core.workspace.mode') - NylasEnv.config.observe 'core.workspace.mode', (mode) => - return if mode is @_preferredLayoutMode - @_preferredLayoutMode = mode + NylasEnv.config.onDidChange 'core.workspace.mode', ({newValue}) => + return if newValue is @_preferredLayoutMode + @_preferredLayoutMode = newValue @popToRootSheet() @trigger() diff --git a/src/global/nylas-observables.coffee b/src/global/nylas-observables.coffee index 04acd4808..c2323051c 100644 --- a/src/global/nylas-observables.coffee +++ b/src/global/nylas-observables.coffee @@ -76,7 +76,7 @@ Rx.Observable.fromStore = (store) => Rx.Observable.fromConfig = (configKey) => return Rx.Observable.create (observer) => - disposable = NylasEnv.config.observe configKey, => + disposable = NylasEnv.config.onDidChange configKey, => observer.onNext(NylasEnv.config.get(configKey)) observer.onNext(NylasEnv.config.get(configKey)) return Rx.Disposable.create(disposable.dispose)