[wp-trac] [WordPress Trac] #38889: Proposition to allow an api.Value() using asynchronous callbacks
WordPress Trac
noreply at wordpress.org
Mon Nov 21 21:23:52 UTC 2016
#38889: Proposition to allow an api.Value() using asynchronous callbacks
-------------------------------+------------------------------
Reporter: nikeo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: trunk
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: javascript
-------------------------------+------------------------------
Comment (by nikeo):
@westonruter the purpose of this proposition is to be able to know when
all callbacks of an api.Value() instance are done, it's not specifically
intended to use the various results of those callbacks, but it can do it.
The use case I had in mind was for sections. For performance improvements,
it could be interesting to always defer the instantiation of settings and
controls when their sections are expanded.
In this case I think that it would be useful to be able to wait for
possible asynchronous content like images to be fetched, before doing
other things in the expanded section, like managing the control
visibilities interdepencies.
In this case, sections would be bound like this :
{{{
#!javascript
api.section( section_id ).expanded.bind( function() {
//returns a promise()
return do_asynchronous_things_to_instantiate_my_controls();
});
}}}
And the user click on a section would fire something like this :
{{{
#!javascript
api.section( section_id ).expanded( true ).done( function() {
//do something in this section when all the controls are instantiated
and embedded.
__do_things_when_section_controls_are_all_ready__();
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38889#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list