Chat-js

Chat-js is a library for FANDOM Chat that abstracts common code patterns in scripts:
 * asynchronous events for chat  availability
 * UI utilities - put your buttons in one place!
 *   is exposed (allowing use of  in chat)

1. Importing the script
To use Chat-js, you need to import it into your script. You can listen for the  event using.

2. Using the library
The library dispatches the following MediaWiki hooks:
 * Fires when the Chat-js library has initialised.
 * Passes  as an argument.
 * Passes  as an argument.


 * Fires when Chat establishes a socket connection and viewmodels are available.
 * Passes  as an argument.
 * Passes  as an argument.


 * Fires after the Chat view has rendered fully.
 * Passes  as an argument.
 * Passes  as an argument.

3. Library utilities
The  object has the following methods/members:
 * (conditional)
 * Description:  availability.


 * (conditional)
 * Description: Completion of Chat initial DOM render.


 * (DOM node)
 * Description: responsive WDS button group.


 * (DOM node)
 * Description: Chat-js stylesheet. Default styling can be deactivated like so:


 * (DOM node) - use with  hook only!
 * Description: Constructor for new chat buttons. Accepts object argument with the following keys:

 
 * - script name (required)
 * - extension attributes and jQuery methods (optional)
 * Example usage:


 * The method returns the argument object, with the button DOM node exposed in the  key.


 * (method) - use with  hook only!
 * Method to return existing buttons as DOM nodes. Requires script name as first parameter.