(CC: @addyosmani @ebidel to double-check some of my logic.)
There are a couple of changes to help make sure there aren't inadvertent API requests made:
Don't rely on JSON.stringify() returning identical strings for the object keys/values. Explicitly check to see if the old and new parameter objects really differ before updating the <core-ajax> parameter string.
Wrapped the check to see if there are any scroll bars visible within a this.async() to give the new content a chance to get added to the DOM first. This prevents a request for the second page of results from being immediately requested.
This also introduces a new attribute, goingBackDays, which offers a shorthand for setting the publishedAfter attribute to a dynamic value corresponding to a number of days in the past.
(CC: @addyosmani @ebidel to double-check some of my logic.)
There are a couple of changes to help make sure there aren't inadvertent API requests made:
JSON.stringify()
returning identical strings for the object keys/values. Explicitly check to see if the old and new parameter objects really differ before updating the<core-ajax>
parameter string.this.async()
to give the new content a chance to get added to the DOM first. This prevents a request for the second page of results from being immediately requested.This also introduces a new attribute,
goingBackDays
, which offers a shorthand for setting thepublishedAfter
attribute to a dynamic value corresponding to a number of days in the past.