Skip to content

Commit

Permalink
Style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Apr 20, 2016
1 parent 64551cb commit 708d2ec
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/createStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,20 @@ export default function createStore(reducer, initialState, enhancer) {
*/
subscribe(observer) {
if (typeof observer !== 'object') {
throw new TypeError('Expected observer to be an object')
throw new TypeError('Expected the observer to be an object.')
}

var observeState = () => {
function observeState() {
if (observer.next) {
observer.next(getState())
}
}

// send initial state to observer
observeState()

// send subsequent states to observer
var unsubscribe = outerSubscribe(observeState)

// return an unsubscribable
return { unsubscribe }
},

[$$observable]() {
return this
}
Expand Down

0 comments on commit 708d2ec

Please sign in to comment.