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