Navigation Menu

Skip to content

Commit

Permalink
Removing RxJS
Browse files Browse the repository at this point in the history
  • Loading branch information
bluedaniel committed Aug 18, 2017
1 parent aa1f09a commit 4c212e6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 27 deletions.
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -13,17 +13,18 @@ See also: [Kakapo for iOS & Android](https://github.com/bluedaniel/Kakapo-native
It's built using:

- [Electron](https://github.com/atom/electron) - Wraps app for desktop.
- [ReactJS](https://github.com/facebook/react) - UI & view components (mostly stateless).
- [Babel 6](https://github.com/babel/babel) - To transform ES6 code.
- [React](https://github.com/facebook/react) - UI & view components.
- [Redux](https://github.com/rackt/redux) - State management.
- [ImmutableJs](https://github.com/facebook/immutable-js) - All stores are immutable maps/lists.
- [Redux Sagas](https://github.com/redux-saga/redux-saga) - Handles side effects.
- [Ramda](https://github.com/ramda/ramda) - For functional Javascript.
- [HowlerJs](https://github.com/goldfire/howler.js) - Handles audio objects.
- [ReactIntl](https://github.com/yahoo/react-intl) - Internationalisation.
- [RxJS](https://github.com/Reactive-Extensions/RxJS) - Search autocomplete and state changes use observables.
- [PostCSS](https://github.com/postcss/postcss) - Transform JS styles.
- [Webpack](https://github.com/webpack/webpack) - Bundling JS and hot module replacement.

Tests are run using [Karma](https://github.com/karma-runner/karma), [Mocha](https://github.com/mochajs/mocha), [Chai](https://github.com/chaijs/chai) and [Enzyme](https://github.com/airbnb/enzyme). Code coverage & reporting provided by [Isparta](https://github.com/douglasduteil/isparta) and [Coveralls](https://coveralls.io/).
Tests using [Jest](https://github.com/facebook/jest) and a bit of [Enzyme](https://github.com/airbnb/enzyme).

Code coverage reporting provided by [Coveralls](https://coveralls.io/).

<img src="https://raw.githubusercontent.com/bluedaniel/Kakapo-assets/master/images/screenshots/web_app.jpg" />

Expand Down
4 changes: 3 additions & 1 deletion app/scripts/sagas/index.js
@@ -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]));
}
28 changes: 28 additions & 0 deletions app/scripts/sagas/konami.js
@@ -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);
}
20 changes: 0 additions & 20 deletions app/scripts/utils/index.js
Expand Up @@ -3,16 +3,7 @@ import fs from 'fs-extra';
import { remote, shell } from 'electron';
import React from 'react';
import { Route } from 'react-router-dom';
import { Observable } from 'rxjs/Observable';
import { flatten } from 'ramda';
import 'rxjs/add/observable/fromEvent';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/windowCount';
import 'rxjs/add/operator/throttleTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/debounceTime';
import { Howler } from 'howler/dist/howler.core.min.js';

export const noop = () => {};
Expand Down Expand Up @@ -130,17 +121,6 @@ export const openLink = (e, link) => {
}
};

// Konami keycode
export const Konami = () =>
Observable.fromEvent(window, 'keyup')
.map(el => el.keyCode)
.windowWithCount(10, 1)
.mergeMap(_x => _x.toArray())
.filter(
seq =>
seq.toString() === [38, 38, 40, 40, 37, 39, 37, 39, 66, 65].toString()
);

// file.mp6 -> invalid
export const validHowl = (url, msg) => {
const codecs = Howler._codecs;
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -74,7 +74,6 @@
"redux-saga": "^0.15.6",
"redux-thunk": "^2.0.1",
"reduxsauce": "^0.6.0",
"rxjs": "^5.4.0",
"semver": "^5.3.0",
"shortid": "^2.2.6",
"whatwg-fetch": "^2.0.3",
Expand Down

0 comments on commit 4c212e6

Please sign in to comment.