verbs
The HypeXAPI.setDefault() function allows you to specify custom XAPI verbs to be used in your Hype documents. This is useful for creating custom statements that can be used to track specific events or user interactions in your Hype document. To use this function, you first need to create an object containing your custom verb definitions. Each verb definition should include an id and display property. The id property should contain the unique id of the verb, while the display property should include an object with a language code (such as "en-US") and the verb's display name in that language. Once you have created your custom verb object, you can then pass it to the HypeXAPI.setDefault() function. This will set your custom verbs as the default verbs to be used in your Hype document. Here is an example of how to use the HypeXAPI.setDefault() function:
In this example, we have defined two custom verbs: "started" and "finished". These verbs can now be used in our Hype document to track when a user starts and finishes an interaction.
You can also specify a function for the verb definition. This function will be evaluated when the verb is used in an XAPI statement. This can be useful for creating dynamic statements that change based on the user's interaction with the document. Once you have created your custom verb object, you can then pass it to the HypeXAPI.setDefault() function. This will set your custom verbs as the default verbs to be used in your Hype document. Here is an example of how to use the HypeXAPI.setDefault() function with a function
arrow notation
function notation
In this example, we have defined a custom verb called "dynamic". This verb is a function that will be evaluated when it is used in an XAPI statement. The function will return a statement with an id and display property that is determined by the value of the customData.dynamicValue property in the Hype document. This allows us to create XAPI statements that are dynamically generated based on the user's interaction with the document.