Improve heartbeat queue checking
|Reported by:||evansolomon||Owned by:||azaozz|
The JS heartbeat API has an isQueued() method, but it also checks whether a given handle is already queued in its enqueue() method (without using isQueued()). Unfortunately the checks are not quite equal. Currently isQueued() will return (likely) incorrect truthy values if you do something like wp.heartbeat.isQueued('constructor'), or the somewhat ironic wp.heartbeat.isQueued('hasOwnProperty').
- The enqueue() method should use the publicly available isQueued() for consistency
- The isQueued() method should use hasOwnProperty()
I also rearranged the order of the queue check in enqueue() to check dont_overwrite before the checking the queue. The dont_overwrite param is falsey by default, so we might as well check that before doing the more expensive operation of checking the queue (we don't care if something is in the queue if we're going to overwrite it anyway).
Change History (16)
- Milestone changed from Awaiting Review to 3.7
- Owner set to azaozz
- Status changed from new to assigned