[wp-trac] [WordPress Trac] #31320: Make customizer JavaScript API available during the live preview
WordPress Trac
noreply at wordpress.org
Sun Feb 28 04:33:55 UTC 2016
#31320: Make customizer JavaScript API available during the live preview
-------------------------+-------------------------
Reporter: Fab1en | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.5
Component: Customize | Version: 4.1
Severity: normal | Resolution: fixed
Keywords: | Focuses: javascript
-------------------------+-------------------------
Changes (by westonruter):
* keywords: needs-patch =>
* status: reopened => closed
* focuses: javascript, performance => javascript
* resolution: => fixed
* milestone: Awaiting Review => 4.5
Comment:
@sidati Hi, there aren't any plans to add a `widgets-ready` or `sidebars-
ready` event. I don't see a use case for why it would be necessary. If you
want to ensure that your code fires after widgets are initialized, you can
do:
{{{#!js
wp.customize.bind( 'ready', _.defer( function() { /* your code here */ } )
);
}}}
@Fab1en: Also, your original use case of wanting to focus on a control
from the preview is not generally available by sending a message from the
preview like this:
{{{#!js
wp.customize.preview.send( 'focus-control-for-setting', 'blogname' );
}}}
Support for sending this message was added in [36586] for #27355 in the
implementation of selective refresh. Shift-clicking on any partial
registered for selective refresh will send this `focus-control-for-
setting` automatically. But you can use it yourself manually outside the
context of partials.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31320#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list