Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simple opinionated state management library based on RxJS and Immutable.js
Simple opinionated state management library based on RxJS
npm install --save rxstate rxjs
Example code for creating a store with status and typeahead fetching action is shown below:
import fetchival from 'fetchival';
import {from} from 'rxjs';
import {map, filter, debounceTime, distinctUntilChanged, tap, flatMap} from 'rxjs/operators';
import {createStore, createAction, createStatus} from 'rxstate';
// create status action
const status = createStatus();
// create action that fetches typeahead suggestions from server
const getTypeahead = createAction();
const typeahead$ = getTypeahead.$.pipe(
map(e => e.target.value),
filter(q => q.length > 3),
debounceTime(300),
distinctUntilChanged(),
tap(() => status('loading')),
flatMap(q => from(fetchival(typeaheadAPI).post({q}))),
tap(() => status('done'))
);
// create an array of action streams for store
const streams = [status.$, typeahead$];
// create store
const store = createStore({streams, defaultState: {init: true}});
// other place in code:
// subscribe for state updates
store.subscribe(state => {
console.log(state);
// ... handle your state here
});
// other place in code:
// trigger action
getTypeahead('keyword');
{...oldState, ...newState}
). You can change that by passing combinator
parameter during store creation, e.g.:// create combinator that always returns new state
const combinator = (_, data) => data;
// create store
const store = createStore({streams, defaultState, combinator});
createStatus
function. By default it'll write status as {status: 'statusText'}
. Key can be changed by passing the string parameter to the function, e.g.:// create status with custom key
const status = createStatus('customStatus');
// state will be updated with {customStatus: 'statusText'}
.clear()
method that accepts new initial state as an optional argument and dispatches new action with either provided or default state as value. If you use default combinator logic - this will reset your state to initial one.FAQs
Simple opinionated state management library based on RxJS and Immutable.js
The npm package rxstate receives a total of 9 weekly downloads. As such, rxstate popularity was classified as not popular.
We found that rxstate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.