-
Notifications
You must be signed in to change notification settings - Fork 1
API
The following specifies methods that you can call on the TUI object.
Gets the TUI meta content
tagname can be one of:
- TUI.META_TUI_ID - to get the id of the current page
- TUI.META_TUI_ID_PREFIX - to get the TUI prefix of the page
- TUI.META_TUI_LIKE_COUNT - get total like count
- TUI.META_TUI_DISLIKE_COUNT - get total dislike count
Sets the TUI meta content
tagname (see TUI.getTuiMeta)
content is the data you wish to place in this tag
Notifies listeners that the tag has been set
Creates a TUI like semantic message (based on the current page) and returns it
Creates a TUI dislike semantic message (based on the current page) and returns it
Creates a TUI changeTitle semantic message (based on the current page) and returns it
newTitle the title you wish to suggest
Creates a TUI comment semantic message (based on the current page) and returns it
comment the comment you wish to post
Encodes a TUI string based on the TUI string formatting format and returns it
str the string to encode
Initialises the TUI object. Should be called on page load and before you start working with this object.
When the TUI object is ready - it notifies all listeners subscribed with the TUI.onReady function.
The TUI object is not always ready to be accessed. It needs to load the id and id prefix and then functions will work as they should.
To handle this, you should subscribe to events so that if something changes - or when the TUI object is ready - you will know it is safe to work with it.
Called when the TUI object has loaded the libraries and set placeholder data in the elements.
Once this has been called you can safely work with TUI - although some data (like id and id prefix) may not be set. You should subscribe to the appropriate events in order to access the data.
f function() to be called when TUI is ready
Called when the ID of the current page has been set.
f function() to be called when the ID has been set
Called when the ID Prefix of the current page has been set.
f function() to be called when the ID Prefix has been set
Called when the like count changes. To access new count call: TUI.getTuiMeta(TUI.META_TUI_LIKE_COUNT)
f function() to be called when the like count changes
Called when the dislike count changes. To access new count call: TUI.getTuiMeta(TUI.META_TUI_DISLIKE_COUNT)
f function() to be called when the dislike count changes