From 31ea092d996f72bed567998307774ab894539230 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 13 Dec 2017 15:39:17 +0000 Subject: [PATCH] Improve createAccountDataAction docs --- src/actions/MatrixActionCreators.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/actions/MatrixActionCreators.js b/src/actions/MatrixActionCreators.js index d1be8abc61..30276e518f 100644 --- a/src/actions/MatrixActionCreators.js +++ b/src/actions/MatrixActionCreators.js @@ -19,7 +19,8 @@ import dis from '../dispatcher'; // TODO: migrate from sync_state to MatrixActions.sync so that more js-sdk events // become dispatches in the same place. /** - * Create a MatrixActions.sync action that represents a MatrixClient `sync` event. + * Create a MatrixActions.sync action that represents a MatrixClient `sync` event, + * each parameter mapping to a key-value in the action. * * @param {MatrixClient} matrixClient the matrix client * @param {string} state the current sync state. @@ -35,13 +36,22 @@ function createSyncAction(matrixClient, state, prevState) { }; } +/** + * @typedef AccountDataAction + * @type {Object} + * @property {string} action 'MatrixActions.accountData'. + * @property {MatrixEvent} event the MatrixEvent that triggered the dispatch. + * @property {string} event_type the type of the MatrixEvent, e.g. "m.direct". + * @property {Object} event_content the content of the MatrixEvent. + */ + /** * Create a MatrixActions.accountData action that represents a MatrixClient `accountData` * matrix event. * * @param {MatrixClient} matrixClient the matrix client. * @param {MatrixEvent} accountDataEvent the account data event. - * @returns {Object} an action of type MatrixActions.accountData. + * @returns {AccountDataAction} an action of type MatrixActions.accountData. */ function createAccountDataAction(matrixClient, accountDataEvent) { return {