Class: Previewer

wp.customize. Previewer


new Previewer(options)

Parameters:
Name Type Description
params.allowedUrls array
params.container string A selector or jQuery element for the preview frame to be placed.
params.form string
params.previewUrl string The URL to preview.
options object
Source:

Extends

Methods


add(key, initial, options)

Create a new Value.
Parameters:
Name Type Description
key string Unique identifier.
initial mixed Initial value.
options mixed Options hash. Optional.
Inherited From:
Source:
Returns:
Class instance of the Value.
Type
Value

initialize(params, options)

Initialize Messenger.
Parameters:
Name Type Description
params object Parameters to configure the messenger. {string} params.url - The URL to communicate with. {window} params.targetWindow - The window instance to communicate with. Default window.parent. {string} params.channel - If provided, will send the channel with each message and only accept messages a matching channel.
options object Extend any instance parameter or method with this object.
Inherited From:
Source:

keepPreviewAlive()

Keep the preview alive by listening for ready and keep-alive messages. If a message is not received in the allotted time then the iframe will be set back to the last known valid URL.
Since:
  • 4.7.0
Source:
Returns:
Type
void

<abstract> query()

Query string data sent with each preview request.
Source:

ready(data)

Handle the preview receiving the ready message.
Parameters:
Name Type Description
data object Data from preview.
Properties
Name Type Description
currentUrl string Current URL.
activePanels object Active panels.
activeSections object Active sections.
activeControls object Active controls.
Since:
  • 4.7.0
Source:
Returns:
Type
void

receive(event)

Receive data from the other window.
Parameters:
Name Type Description
event jQuery.Event Event with embedded data.
Inherited From:
Source:

refresh()

Refresh the preview seamlessly.
Since:
  • 3.4.0
Source:
Returns:
Type
void

send(id, data)

Send data to the other window.
Parameters:
Name Type Description
id string The event name.
data object Data.
Inherited From:
Source: