Files
freeCodeCamp/client/sagas/title-saga.js

17 lines
416 B
JavaScript
Raw Normal View History

2016-01-27 11:34:44 -08:00
// (doc: Object) =>
// () =>
// (next: (action: Action) => Object) =>
// titleSage(action: Action) => Object|Void
export default (doc) => () => next => {
return function titleSage(action) {
// get next state
const result = next(action);
if (action !== 'updateTitle') {
return result;
}
const newTitle = result.app.title;
doc.title = newTitle;
return result;
};
};