[wp-trac] [WordPress Trac] #31819: Shiny updates: more sophisticated locking

WordPress Trac noreply at wordpress.org
Tue Mar 31 15:04:15 UTC 2015


#31819: Shiny updates: more sophisticated locking
-----------------------------+---------------------------------------------
 Reporter:  DavidAnderson    |       Owner:
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  4.2
Component:  Upgrade/Install  |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  ui, javascript, administration
-----------------------------+---------------------------------------------
Changes (by jorbin):

 * milestone:  Awaiting Review => 4.2


Comment:

 I feel like the lock being an array of functions is more complicated than
 it needs to be while also not really assisting in making this as
 functional as possible.


 One idea that I have in order to help UpdraftPlus or any other plugin that
 has existing bindings for the updates page to to add a jquery event to the
 document at the end of `$( document ).ready` signifying that we have
 completed adding our events.  This way a plugin can optionally deregister
 a binding and add there own. This would require that we move the bindings
 into named functions, but reducing anonymous functions is generally a good
 idea.   Essentially could imagine plugins using code that looks like this:

 {{{
 $( document ).ready( function(){
     $( '.plugin-update-tr .update-link' ).on( 'click',
 my_cool_plugin_function );
 });

 $( document ).on( 'wp.updates.eventready' , function(){
     $( '.plugin-update-tr .update-link' ).off( 'click',
 my_cool_plugin_function );
     $( '.plugin-update-tr .update-link' ).off( 'click',
 wp.updates.updatelinkclick );

     $( '.plugin-update-tr .update-link' ).on( 'click',
 my_cool_plugin_function_with_code_that_makes_sense_for_4.2 );
 });

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31819#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list