Add documentation regarding updates

This commit is contained in:
Connor Christie
2018-01-01 10:38:00 -06:00
parent 80b84212cc
commit 7bb11d6436
2 changed files with 17 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ var MM = (function() {
* argument notification string - The identifier of the notification. * argument notification string - The identifier of the notification.
* argument payload mixed - The payload of the notification. * argument payload mixed - The payload of the notification.
* argument sender Module - The module that sent 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) { var sendNotification = function(notification, payload, sender, sendTo) {
for (var module of modules) { for (var module of modules) {
@@ -94,6 +95,8 @@ var MM = (function() {
* *
* argument module Module - The module that needs an update. * argument module Module - The module that needs an update.
* argument speed Number - The number of microseconds for the animation. (optional) * 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) { var updateDom = function(module, speed) {
return new Promise((resolve) => { 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) { var updateDomWithContent = function(module, speed, newHeader, newContent) {
return new Promise((resolve) => { return new Promise((resolve) => {
if (module.hidden || !speed) { if (module.hidden || !speed) {
@@ -146,6 +159,7 @@ var MM = (function() {
* Check if the content has changed. * Check if the content has changed.
* *
* argument module Module - The module to check. * 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. * argument newContent Domobject - The new content that is generated.
* *
* return bool - Does the module need an update? * return bool - Does the module need an update?
@@ -173,6 +187,7 @@ var MM = (function() {
* Update the content of a module on screen. * Update the content of a module on screen.
* *
* argument module Module - The module to check. * 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. * argument newContent Domobject - The new content that is generated.
*/ */
var updateModuleContent = function(module, newHeader, newContent) { var updateModuleContent = function(module, newHeader, newContent) {

View File

@@ -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. - `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. - `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)` #### `socketNotificationReceived: function(notification, payload)`