App Framework Reference

Splunk API

Splunk.util

The Splunk.util namespace encapsulates utilities that expose core functionality.

Language Binding

JavaScript

Declaration

$SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/js/util.js

Implementation Location

$SPLUNK_HOME/etc/apps/<appName>/appserver/modules/<moduleName>

Import

import splunk.util

Properties

moduleLoadStates WAITING_FOR_INITIALIZATION
WAITING_FOR_HIERARCHY
WAITING_FOR_CONTEXT
HAS_CONTEXT
Module still being loaded.
Module still being loaded.
A post-load state.
A post-load state.

See getLoadState(), setLoadState(), and onLoadStatusChange().

Example: module.setLoadState(Splunk.util.moduleLoadStates.WAITING_FOR_CONTEXT);

Methods

addLeadingSearchCommand() Prefixes a search string to the specified search string.
discoverReplacementTokens() Gets an array of unique replacement tokens.
escapeBackslash() Escapes backslash characters found in a string.
escapeHtml() Escapes HTML entities in a string.
fieldListToString() Serializes an array into a comma-separated string.
getCommaFormattedNumber() Converts numbers to comma-notated format.
getComputedStyleHelper() Gets the value of the specified style for the specified element.
getConfigValue() Gets SplunkWeb configuration values stored in the DOM.
getCumlativeOffsetLeft() Gets offset of the DOM element offsetLeft and offsetParent property.
getCumlativeOffsetTop() Gets the value of the DOM element offsetTop and offsetParent parameters.
getCurrentApp() Gets the current app name as stored in the DOM.
getCurrentDisplayView() Gets the current displayView name.
getCurrentView() Gets the current view value.
getCurrentViewConfig() Gets a dictionary of app, view, and saved search configuration data.
getEpochTimeFromISO() Gets an epoch time equivalent to the specified ISO time.
getHEX() Gets the hexadecimal equivalent of the specified RGB value.
getPageYOffset() Gets the amount of content hidden by scrolling down.
getParameter() Gets the GET parameter from window.location.
getPath() Gets the current location path without the localization segment.
getServerTimezoneOffset() Gets the current server timezone offset.
getTimezoneOffsetDelta() Gets the time delta between the specified offset and date.
getWindowDimensions() Gets the inner dimensions of the current window.
isInt() Tests if the specified value is an integer.
make_full_url() Builds a qualified query string.
make_url() Extends the specified path relative to the current app server location.
normalizeBoolean() Normalizes various boolean syntax idioms.
normalizeColor() Converts an RGB or hex color value to a fully-qualified hex equivalent.
objectSimilarity() Compares two objects.
propToQueryString() Serializes the specified properties dictionary into an query string.
queryStringToProp() De-serializes the specified query string into an object literal.
redirect_to() A window.document.location wrapper.
replaceTokens() Performs regular expression-based token replacement.
smartTrim() Gets a string trimmed to a specified length.
stringToFieldList() De-serializes a specified comma-separated string into an array.
stripLeadingSearchCommand() Gets an unqualified search string by stripping any leading search string.