Functions in Hype xAPI
HypeXAPI

HypeXAPI.setDefault

2min

The setDefault function allows you to override a global default by key or to override all defaults at once by passing in an object. To override a specific default, pass in the key as the first argument and the value you want to set as the second argument. For example, to override the default for the key "name", you would do the following:

JS


In the following example, the setDefault function is being used to override the defaults for the key "verbs". The new default values that are being set are an object with the keys "started" and "finished". Each of these keys has an id and display value.

This function can be useful if you want to change the default values for a specific key or for all keys at once.

JS


Verbs constitute a special case over defaults like (object, context etc.). If a verb statement is referenced later in the GUI, it is also looked up in ADL.verbs as a fallback. This allows for the use of common verbs in the GUI without having to duplicate them in your default verbs, as they will be fetched from the fallback.