Linting
parent
31a52c15bd
commit
53e7232a97
|
@ -24,7 +24,7 @@ import dis from '../dispatcher';
|
||||||
* a failure.
|
* a failure.
|
||||||
* @param {function} fn the function to call with arguments given to the
|
* @param {function} fn the function to call with arguments given to the
|
||||||
* returned function. This function should return a Promise.
|
* returned function. This function should return a Promise.
|
||||||
* @returns a function that dispatches asynchronous actions when called.
|
* @returns {function} a function that dispatches asynchronous actions when called.
|
||||||
*/
|
*/
|
||||||
export function createPromiseActionCreator(id, fn) {
|
export function createPromiseActionCreator(id, fn) {
|
||||||
return (...args) => {
|
return (...args) => {
|
||||||
|
@ -33,8 +33,8 @@ export function createPromiseActionCreator(id, fn) {
|
||||||
dis.dispatch({action: id + '.success', result});
|
dis.dispatch({action: id + '.success', result});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
dis.dispatch({action: id + '.failure', err});
|
dis.dispatch({action: id + '.failure', err});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,13 +46,13 @@ export function createPromiseActionCreator(id, fn) {
|
||||||
* event_type: matrixEvent.getType(),
|
* event_type: matrixEvent.getType(),
|
||||||
* event_content: matrixEvent.getContent(),
|
* event_content: matrixEvent.getContent(),
|
||||||
* }
|
* }
|
||||||
* @param matrixClient{MatrixClient} the matrix client with which to register
|
* @param {MatrixClient} matrixClient the matrix client with which to register
|
||||||
* a listener.
|
* a listener.
|
||||||
* @param eventId{string} the ID of the event that hen emitted will cause the
|
* @param {string} eventId the ID of the event that hen emitted will cause the
|
||||||
* an action to be dispatched.
|
* an action to be dispatched.
|
||||||
* @returns a function that, when called, will begin to listen to dispatches
|
* @returns {function} a function that, when called, will begin to listen to
|
||||||
* from matrixClient. The result from that function can be called to
|
* dispatches from matrixClient. The result from that
|
||||||
* stop listening.
|
* function can be called to stop listening.
|
||||||
*/
|
*/
|
||||||
export function createMatrixActionCreator(matrixClient, eventId) {
|
export function createMatrixActionCreator(matrixClient, eventId) {
|
||||||
const listener = (matrixEvent) => {
|
const listener = (matrixEvent) => {
|
||||||
|
@ -67,6 +67,6 @@ export function createMatrixActionCreator(matrixClient, eventId) {
|
||||||
matrixClient.on(eventId, listener);
|
matrixClient.on(eventId, listener);
|
||||||
return () => {
|
return () => {
|
||||||
matrixClient.removeListener(eventId, listener);
|
matrixClient.removeListener(eventId, listener);
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue