Namespace: utils

wp.customize. utils

Utility function namespace
Source:

Methods


<static> areElementListsEqual(listA, listB)

Return whether the two lists of elements are the same and are in the same order.
Parameters:
Name Type Description
listA Array | jQuery
listB Array | jQuery
Since:
  • 4.1.0
Source:
Returns:
Type
boolean

<static> bubbleChildValueChanges(instance, properties)

Watch all changes to Value properties, and bubble changes to parent Values instance
Parameters:
Name Type Description
instance wp.customize.Class
properties Array The names of the Value instances to watch.
Since:
  • 4.1.0
Source:

<static> getCurrentTimestamp()

Get current timestamp adjusted for server clock time. Same functionality as the `current_time( 'mysql', false )` function in PHP.
Since:
  • 4.9.0
Source:
Returns:
Current timestamp.
Type
int

<static> getRemainingTime(datetime)

Get remaining time of when the date is set.
Parameters:
Name Type Description
datetime string | int | Date Date time or timestamp of the future date.
Since:
  • 4.9.0
Source:
Returns:
remainingTime - Remaining time in milliseconds.
Type
int

<static> highlightButton(button [, options])

Highlight the existence of a button. This function reminds the user of a button represented by the specified UI element, after an optional delay. If the user focuses the element before the delay passes, the reminder is canceled.
Parameters:
Name Type Argument Description
button jQuery The element to highlight.
options object <optional>
Options.
Properties
Name Type Argument Default Description
delay number <optional>
0 Delay in milliseconds.
focusTarget jQuery <optional>
A target for user focus that defaults to the highlighted element. If the user focuses the target before the delay passes, the reminder is canceled. This option exists to accommodate compound buttons containing auxiliary UI, such as the Publish button augmented with a Settings button.
Since:
  • 4.9.0
Source:
Returns:
An idempotent function that cancels the reminder.
Type
function

<static> isKeydownButNotEnterEvent(event)

Return whether the supplied Event object is for a keydown event but not the Enter key.
Parameters:
Name Type Description
event jQuery.Event
Since:
  • 4.1.0
Source:
Returns:
Type
boolean

<static> parseQueryString(queryString)

Parse query string.
Parameters:
Name Type Description
queryString string Query string.
Since:
  • 4.7.0
Source:
Returns:
Parsed query string.
Type
object

<static> prioritySort(a, b)

Stable sort for Panels, Sections, and Controls. If a.priority() === b.priority(), then sort by their respective params.instanceNumber.
Parameters:
Name Type Description
a wp.customize.Panel | wp.customize.Section | wp.customize.Control
b wp.customize.Panel | wp.customize.Section | wp.customize.Control
Since:
  • 4.1.0
Source:
Returns:
Type
Number