Yo.utils

Yo.utils is the namespace for all utility functions in the Yottaa Rapid JS API library.The utility functions simplify a number of routine housekeeping tasks related to managing your Yottaa application.

Prerequisites

The following command to load the appropriate version of the Rapid+JS Library must precede the use of this function on the page. Specify your own site key:

<script src="https://rapid-cdn.yottaa.com/rapid/lib/sitekey.js"></script>

Returns

Delayed Object

Types

Yo.utils.log

Allows developers to print to the console.log and perform related actions.

Yo.utils.addEvent

Cross-browser functionality to create and register an event on the supplied Document Object Model (DOM) element using the method most appropriate for the shopper's browser.

Yo.utils.removeEvent

Cross-browser functionality to remove an event on the supplied DOM element using the method most appropriate for the browser.

Yo.utils.browser

Retrieves the name and version of the current shopper's browser.

Yo.utils.console

Displays a variety of statistics and debugging information for the current page on the browser's developer console.

Yo.utils.def

Helper function that checks whether the specified item is defined.

Yo.utils.undef

Helper function that checks whether the specified item is not defined.

Yo.utils.getCookie

Gets the value of a cookie, based on the cookie name.

Yo.utils.setCookie

Sets a cookie in your Yottaa application.

Yo.utils.isFunction

Tests whether the named object is a function.

Yo.utils.matchURL

Tests how Yottaa matches a specified URL to a specified source.

Yo.utils.select

Selects a DOM element by id (either "id" or "#id"), by class name (".classname"), or by any attribute you can match using a regular expression.

Yo.utils.writeHTML

Inserts an HTML string before the specified DOM element, or appends it into the element at the end of the existing content.