bool onBeforeInit ( data )

The event activates before the chat widget initializes.

The data object is passed as an argument, containing the following properties:

PropertyTypeDescription
status integer The status that the chat widget will initialize in if the handler returns "true". 1 -- Online, 2 -- Offline.
The "onBeforeInit" event handler should return true if initialization is permitted and false if not. If the handler returned nothing (undefined), it is treated equally as initialization is not permitted (the "false" value).

Examples

  1. With jQuery
    $(document).on("netroxbeforeinit", function(event, data) {
        if (data.status == 1) {
            return confirm("Initialize chat widget?");
        }
        return true;
    });       
  2. Using the nsc_API object
    nsc_API = { /* ... */ };
    
    nsc_API.onBeforeInit = function(data) {
        if (data.status == 1) {
            return confirm("Initialize chat widget?");
        }
        return true;
    };        

All rights reserved. Copyright © 2017 Netrox SC
Host CMS