How to: public methods

Here's the updated list of public methods that you can use to initiate an action with the player. You may need your developer's assistance to implement this.
 

Example:

inline_manual_player.activateTopic(1234);

activateTopic

Activates a topic at its first step.

If any other topic is currently active, it will be deactivated before the new one is activated.

activateTopic(topic_id)
topic_id (string) - Existing identifier of a topic to be activated.
 

activateStep

Activates a topic at the specified step. Same rules apply here as with activateTopic method.

activateStep(topic_id, step_id) topic_id (string) - Existing identifier of a topic to be activated. step_id (int, default 0) - Index of step to be activated.  

goToStep

Activates specific step within the currently active topic. If no topic is active or if such a step does not exist, nothing happens.

If you want to be sure that specific step of the specific topic will be activated, use activateStep instead.

This method is useful if you want to control currently active topic via previous and/or next keywords.

goToStep(step_id) step_id (int or previous or next) - Index of a step within the currently active topic to be activated. You can also use keywords previous and/or next.  

deactivate

Deactivates any currently active topic. Does nothing if no topic is active.

deactivate()  

getCurrentTopic

Returns the ID of the currently active topic. If no topic is active, returns null.

getCurrentTopic()  

getCurrentStep

Returns index of the currently active step. If no topic is active, returns null.

getCurrentStep()  

setLanguage

Switch Inline Manual player into specific language on the fly. Works as well if there is a Topic and Step playing.

setLanguage(language) language (string) - ISO 639-1 code of a language to switch to
 

setMetadata

Sets list of variables used when evaluating rules.

It mixes new variables with existing ones. This is necessary if we want to use these variables together with metadata defined in tracking. If you need to remove a metadata variable, set it's value to null.

setMetadata(metadata) metadata - the Key-value object containing the list of variables. Keys will be as variable names, referenced from rules. Values can be of any type. Example

inline_manual_player.setMetadata({
  username: 'john',
  roles: ['developer', 'admin'],
  born: new Date(1978, 3, 18)
});
 

hidePanel

Closes panel with the list of topics, if it is active. Does nothing otherwise.

hidePanel()  

showPanel

Opens panel with the list of topics, if it is not active. Does nothing otherwise.

showPanel()  

togglePanel

If panel with the list of topics is open, closes it. If it is closed, opens it.

togglePanel()  

destroy

This will completely remove the Player object from the document:

deactivate any currently active topic remove event listeners added to the document remove any DOM elements (UI) added to the document After the Player is destroyed, and you want to use it again, it will be much easier to create a new one than trying to re-create it. Don't use this method unless you really want the Player gone.

Was this article helpful?