CumulusUtils Runtime Library

From Cumulus Wiki
Revision as of 07:11, 27 June 2024 by HansR (talk | contribs) (→‎Usage)
Jump to navigationJump to search

Introduction

CumulusUtils.js is the javascript runtime library providing the modular user with functionality otherwise available only in the website. It provides e.g. timing, realtime values, clocks and report loading. It is intended for users who are using CumulusUtils in a modular fashion. The available globals and functions are described below.

The library can be found in the utils directory (on the CumulusMX machine) and is transferred after generation to the lib directory on the server.

The library is generated implicitly with the Website command parameter or on its own with the CUlib parameter:

utils/bin/cumulusutils.exe CUlib         => this command creates the library in the lib directory on the server

The user is free to load the library in the editor (formatting required) and make suggestions or modify changes. When modifying support is not available anymore.

Usage

NOTE: the publication of the library requires feedback by the users if anything does not work as expected or as intended!
NOTE: Be aware the globals are for internal use and are generated with CUtils parameter values. Changes to these globals is disadvised and they are lost when generating a new version of the library.
NOTE: cumulusutils.js requires jquery for proper functioning and d3 when using the sun and moon discs.

The library is intended to be used when CUtils is used in a modular fashion. Any other use is not supported. When using modules which require javascript to function properly (e.g. the Graphs modules) cumulusutils.js must be included in the users webpage using the following HTML code:

<script defer src='lib/cumulusutils.js'></script>

Globals

Commandline parameters

CumulusUtils handles URL parameters and uses the following global for this:

const urlParams = new URLSearchParams(window.location.search);

The Cutils modules will make use of this global, if the user wishes to handle URL parameters for all pages it would be a good idea to use this parameter.

Functions

All functions are initialised including the timers and output will be displayed in the users website if a specific DIV with an id is used e.g.

will display the Sun disc and update it over the day.

Init function