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
1 parent
aa1f09a
commit 4c212e6
Showing
6 changed files
with
38 additions
and
27 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
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,9 +1,11 @@ | ||
import { map } from 'ramda'; | ||
import { all, call } from 'redux-saga/effects'; | ||
import notifications from './notifications'; | ||
import search from './search'; | ||
import sounds from './sounds'; | ||
import themes from './themes'; | ||
import konami from './konami'; | ||
|
||
export default function*() { | ||
yield all([call(sounds), call(notifications), call(search), call(themes)]); | ||
yield all(map(call, [sounds, notifications, search, themes, konami])); | ||
} |
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,28 @@ | ||
import { eventChannel } from 'redux-saga'; | ||
import { fork, call, take, put } from 'redux-saga/effects'; | ||
import { compose, join, equals, append, takeLast } from 'ramda'; | ||
import { notifyActions } from 'actions/'; | ||
import { noop } from 'utils/'; | ||
|
||
const konamiChan = () => | ||
eventChannel(emit => { | ||
const code = join(' ', [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]); | ||
let entered = []; | ||
document.addEventListener('keydown', ({ keyCode }) => { | ||
entered = compose(takeLast(10), append(keyCode))(entered); | ||
if (equals(code, join(' ', entered))) emit(true); | ||
}); | ||
return noop; | ||
}); | ||
|
||
function* konami() { | ||
const chan = yield call(konamiChan); | ||
while (true) { | ||
yield take(chan); | ||
yield put(notifyActions.send('🎉 ️😍 You are awesome! 😍 🎉')); | ||
} | ||
} | ||
|
||
export default function* rootSaga() { | ||
yield fork(konami); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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