new Messenger()
A communicator for sending data from one window to another over postMessage.
- Mixes In:
- wp.customize.Events
- Source:
Extends
- wp.customize.Class
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. - 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. - Source:
-
receive(event)
-
Receive data from the other window.
Parameters:
Name Type Description event
jQuery.Event Event with embedded data. - Source:
-
send(id, data)
-
Send data to the other window.
Parameters:
Name Type Description id
string The event name. data
object Data. - Source: