[wp-trac] [WordPress Trac] #23216: Create "WP Heartbeat" API

WordPress Trac noreply at wordpress.org
Tue Jul 16 20:53:04 UTC 2013


#23216: Create "WP Heartbeat" API
--------------------------------------+---------------------
 Reporter:  azaozz                    |       Owner:
     Type:  task (blessed)            |      Status:  closed
 Priority:  normal                    |   Milestone:  3.6
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  autosave-redo needs-docs  |
--------------------------------------+---------------------

Comment (by carldanley):

 After talking with nacin on IRC, I reviewed the status of the heartbeat JS
 file and made changes to improve the quality and performance. I've
 organized my changes into a 3.6 ship list. I honestly think that this
 whole patch should be shipped. Please let me know if you have any
 questions.

 Can't ship without these, imo
 =============================
 - cleaned up a lot of code that was missing semi-colons and other things
 - explicitly declare exposed function calls for a clear idea of what
 is/isn't available to a user through public API methods
 - moved the values of `autostart` and `connectionLost` to internal
 variables and created 2 new functions: `shouldAutoStart()` and
 `_hasActiveConnection()` respectively. See notes below about changing
 respective areas.
 - fixed a lot of missing semi-colons from various areas
 - added a layer of caching to various settings and objects used
 internally. This should speed things up a little.
 - fixed an issue where timers could be potentially duplicated
 - added rigorous notes and questions/comments to `todo:`'s
 - moved a few random snippets of code (e.g.- things like L334, L282) into
 `_initialize()` function and other places that make more sense
 - the use of brackets is preferred standard in JS and the current
 iteration was lacking a ton of brackets all over the place

 Optional but really should be included
 ======================================
 - removed a lot of unnecessary named function expressions which make
 debugging a little more difficult due to anonymity
 - added a heavy set of code documentation
 - changed the logic of the switch fall-through's defined in last
 iteration, specifically `errorstate()` which has now become
 `_triggerError()`. This was a private name change and doesn't affect
 anything in the API.
 - moved random prototype extension on L463 to actual functions so things
 are consistent

 Not too important but added while redoing everything else
 =========================================================
 - changed various internal variable names for clarity when reading code
 really put effort into this as a lot of things were pretty confusing
 previously
 - added a few extra internal helper functions to enhance clarity while
 reading the code.
 - renamed a few internal helper functions for clarity
 - moved a few anonymous jQuery event callbacks into separate functions for
 clarity

--
Ticket URL: <http://core.trac.wordpress.org/ticket/23216#comment:94>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list