AUI Documentation

Helper functions

Ask a question
Function Description Available since Example
contextPath

The AJS.contextPath() function returns the "path" to the application, which is needed when creating absolute urls within the application, e.g.:

  • var url = AJS.contextPath() + "/rest/some/resource";
  • var url = AJS.contextPath() + "/dashboard.action";
3.5.5
Cookie

store values in a persistent cookie without worrying about the application using too many cookies.

3.5.5
debounce

Makes sure that a constantly firing function doesn't cause performance issues.

Don't Use when binding to an infrequently firing event.

5.1
debounceImmediate

Like debounce(), makes sure that a constantly firing function doesn't cause performance issues, but fires at the start rather than at the end of the wait period.

Don't Use when binding to an infrequently firing event.

5.9
escapeHTML

The AJS.escapeHtml() performs html-safe escaping of the input string. Specifically, it encodes:

  • <
  • >
  • &
  • '
  • "
4.0
format

Provides an easy way to substitute parameters into a string.

1.0
I18n.getText

AUI includes a web resource transformer that will translate some javascript into the literal strings before being served.

3.5.5
isDirty

Make sure users cannot accidentally lose data.

2.0
log

A safe alternative to console.log(). It ensures that both console and the console.log method exist before executing. This means if you happen to leave one in your code, browsers which don't support console.log (eg. IE, some mobile browsers) shouldn't break.

1.0
version

Detects the version of AUI on the current page.

1.2