omphalos.Skepsis
omphalos.Skepsis(key, defaultValue);A Skepsis (as in omphaloskepsis) is an object that wraps a specified
bundle variable so that you don’t need to constantly call
omphalos.storage.get() to get the value, omphalos.storage.set() to
change the value, or omphalos.storage.on() in order to be told when the
value changes.
Instead, you can create a Skepsis, giving the name of the variable
that you would like to have access to; the returned object has the
following properties:
valueis the value of the variable; you can also assign to this in order to change the value, which automatically notifies all other listeners.update()is for variables that are of typeObjectorArray; when changing the interior structure of the value, an automatic update will not be triggered until you invokeupdateon it. When the value of the variable is not an object, this does nothing.
// Create a Skepsis that wraps the variable named; if the variable// does not yet exist, then the default value is as defined.const sample = omphalos.Skepsis('sampleVar', 0);
// Get the value of the variable; this is always the updated value,// even if something in another component (panel, graphic, extension)// updates itconsole.log(sample.value);
// Change the value; all listeners are immediately notifiedsample.value = 69;
// If a Skepsis is an object, then changing inner fields requires you// to manually invoke update() to cause the update to occur.const objValue = omphalos.Skepsis('objVar', {});objValue.value.name = 'OdatNurd';objValue.update()