0.10.9 • Published 4 years ago
@dlghq/dialog-utils v0.10.9
Dialog JavaScript utils
A collection of utility libraries used by Dialog projects.
Installation
npm install --save @dlghq/dialog-utils
Usage
import { isElectron } from '@dlghq/dialog-utils';
console.log('isElectron: ', isElectron());
Redux
import { Field } from '@dlghq/dialog-utils';
Field.create({ value: '' })
.map((value) => 'foo')
.flatMap((value, error, pending) => new Field(value, error, true))
.render((value, error, pending) => (
<FieldView value={value} pending={pending} />
));
function addContact(uid: number) {
return ({ dispatch, messenger }) => {
Field.dispatch({
dispatch,
type: '@@dialog/USER_CONTACT_ADD',
context: uid,
action: messenger.contacts.add(uid),
initialState: null,
});
};
}
dispatch(addContact(123));
// { type: '@@dialog/USER_CONTACT_ADD', payload: { value: null, error: null, pending: true }, meta: { context: 123 } }
// then
// { type: '@@dialog/USER_CONTACT_ADD', payload: { value: <response>, error: null, pending: false }, meta: { context: 123 } }
// or
// { type: '@@dialog/USER_CONTACT_ADD', payload: { value: null, error: <error>, pending: false }, meta: { context: 123 } }
License
0.10.9
4 years ago
0.10.8
4 years ago
0.10.7
5 years ago
0.10.6
5 years ago
0.10.5
5 years ago
0.10.4
5 years ago
0.10.3
5 years ago
0.10.2
5 years ago
0.10.1
5 years ago
0.10.0
5 years ago
0.9.3-babel7.0
5 years ago
0.9.3-0
6 years ago
0.9.2
6 years ago
0.9.1
6 years ago
0.9.0
6 years ago
0.8.4
6 years ago
0.8.3
6 years ago
0.8.2
6 years ago
0.8.1
6 years ago
0.8.0
6 years ago
0.7.1
7 years ago
0.7.0
7 years ago
0.6.5
7 years ago
0.6.4
7 years ago
0.6.3
7 years ago
0.6.2
7 years ago
0.6.1
7 years ago
0.6.0
7 years ago
0.5.1
7 years ago
0.5.0
7 years ago
0.4.1
7 years ago
0.4.0
7 years ago
0.3.0
7 years ago
0.2.0
7 years ago
0.1.0
7 years ago