This repository has been archived by the owner on Apr 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
80 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
export const SELECT_TAB = 'SELECT_TAB'; | ||
export const REFRESH_TAB_TIME = 'REFRESH_TAB_TIME'; | ||
|
||
export const selectTab = (tab, account) => { | ||
return { type: SELECT_TAB, tab, account } | ||
} | ||
|
||
export const refreshTabTime = (tab, account) => { | ||
return { type: REFRESH_TAB_TIME, tab, account } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Actions from '../actions'; | ||
|
||
export const nowsByUserId = (state = {}, action) => { | ||
switch (action.type) { | ||
case Actions.REFRESH_TAB_TIME: | ||
case Actions.SELECT_TAB: | ||
return { | ||
...state, | ||
[action.account.id_str]: { | ||
...(state[action.account.id_str] || {}), | ||
[action.tab]: Date.now(), | ||
} | ||
}; | ||
default: | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Actions from '../actions'; | ||
import RichState from './rich-state'; | ||
|
||
export default class TimeRefresher { | ||
static subscribe(store) { | ||
new TimeRefresher(store).subscribe(); | ||
} | ||
|
||
constructor(store) { | ||
this.store = store; | ||
} | ||
|
||
subscribe() { | ||
setInterval(this.refresh.bind(this), 1000 * 60); | ||
} | ||
|
||
refresh() { | ||
let state = new RichState(this.store); | ||
this.store.dispatch( | ||
Actions.refreshTabTime( | ||
state.activeTab(), | ||
state.activeAccount(), | ||
) | ||
); | ||
} | ||
} |