From 7bb11d6436a70e0e2ab80e4bf27aaf22463285e6 Mon Sep 17 00:00:00 2001 From: Connor Christie Date: Mon, 1 Jan 2018 10:38:00 -0600 Subject: [PATCH] Add documentation regarding updates --- js/main.js | 15 +++++++++++++++ modules/README.md | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index e3412e14..782b6863 100644 --- a/js/main.js +++ b/js/main.js @@ -80,6 +80,7 @@ var MM = (function() { * argument notification string - The identifier of the notification. * argument payload mixed - The payload of the notification. * argument sender Module - The module that sent the notification. + * argument sendTo Module - The module to send the notification to. (optional) */ var sendNotification = function(notification, payload, sender, sendTo) { for (var module of modules) { @@ -94,6 +95,8 @@ var MM = (function() { * * argument module Module - The module that needs an update. * argument speed Number - The number of microseconds for the animation. (optional) + * + * return Promise - Resolved when the dom is fully updated. */ var updateDom = function(module, speed) { return new Promise((resolve) => { @@ -113,6 +116,16 @@ var MM = (function() { }); }; + /* updateDomWithContent(module, speed, newHeader, newContent) + * Update the dom with the specified content + * + * argument module Module - The module that needs an update. + * argument speed Number - The number of microseconds for the animation. (optional) + * argument newHeader String - The new header that is generated. + * argument newContent Domobject - The new content that is generated. + * + * return Promise - Resolved when the module dom has been updated. + */ var updateDomWithContent = function(module, speed, newHeader, newContent) { return new Promise((resolve) => { if (module.hidden || !speed) { @@ -146,6 +159,7 @@ var MM = (function() { * Check if the content has changed. * * argument module Module - The module to check. + * argument newHeader String - The new header that is generated. * argument newContent Domobject - The new content that is generated. * * return bool - Does the module need an update? @@ -173,6 +187,7 @@ var MM = (function() { * Update the content of a module on screen. * * argument module Module - The module to check. + * argument newHeader String - The new header that is generated. * argument newContent Domobject - The new content that is generated. */ var updateModuleContent = function(module, newHeader, newContent) { diff --git a/modules/README.md b/modules/README.md index 76973996..0b5c2d7c 100644 --- a/modules/README.md +++ b/modules/README.md @@ -230,11 +230,12 @@ notificationReceived: function(notification, payload, sender) { } ```` -**Note:** the system sends two notifications when starting up. These notifications could come in handy! +**Note:** the system sends three notifications when starting up. These notifications could come in handy! - `ALL_MODULES_STARTED` - All modules are started. You can now send notifications to other modules. - `DOM_OBJECTS_CREATED` - All dom objects are created. The system is now ready to perform visual changes. +- `MODULE_DOM_CREATED` - This module's dom has been fully loaded. You can now access your module's dom objects. #### `socketNotificationReceived: function(notification, payload)`