Revision as of 23:08, August 21, 2016 by Bfriend (talk | contribs) (Common)
Jump to: navigation, search

Common

Common is a utility object available for import into Plugins/Widgets and Extensions. It provides common utility functions and dynamic generates common HTML Containers used throughout Genesys Widgets.

Methods

Common.generate.container({options})

Dynamically generates a new HTML Container in matching the style of Genesys Widgets with the selected components you request in your options object.

Argument Type Description
theme string Name of the theme you want to use. This name is specified in window._genesys.main.themes. Default themes are 'light' and 'dark'.


Example

"Check for window._genesys.main"

Common.generate.buttons({options})

Dynamically generates a new HTML Container in matching the style of Genesys Widgets with the selected components you request in your options object.

Argument Type Description
theme string Name of the theme you want to use. This name is specified in window._genesys.main.themes. Default themes are 'light' and 'dark'.


Example

"Check for window._genesys.main"

Common.checkPath(object, path)

Check for the existence of a sub-property of an object at any depth. Returns the value of that property if found otherwise it returns false. Useful for checking configuration object paths without having to check each sub-property level individually.

Argument Type Description
object object An Object you want checked for a particular sub property at any depth
path string The object path in dot notation you wish to search for.


Example

"Check for window._genesys.main"

 
    var oMainConfig = false;

    if(oMainConfig = Common.checkPath(window, "_genesys.main")){
        
        //... Utilize oMainConfig
    }


Common.linkify(string, options)

Search for and convert URLs within a string into HTML links. Returns transformed string.

Argument Type Description
string string An Object you want checked for a particular sub property at any depth
options object A list of options to apply to the linkify operation.
options.target string Choose the HTML TARGET attribute to apply to the generated links. Default is "_blank". Set this option to "self" to apply the target "_self" to the generated links.


Example

"Check for window._genesys.main"

 
    var sString = "Please visit www.genesys.com";

    sString = Common.linkify(sString, {target: 'self'});

    // sString == "Please visit <a href='www.genesys.com' target='_self'>www.genesys.com</a>'"
Comments or questions about this documentation? Contact us for support!