Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
New: Adding URL history save event
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodek committed Sep 14, 2018
1 parent 79fa4ba commit 76652e9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions arc-request-logic.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@
e.stopImmediatePropagation();
const request = e.detail;
this.processRequest(request);
window.requestAnimationFrame(() => {
this._reportUrlHistory(request.url);
});
}
/**
* Dispatches `url-history-store` custom event which is a part of request logic
* to store URL history.
* @param {String} value Request URL
*/
_reportUrlHistory(value) {
this.dispatchEvent(new CustomEvent('url-history-store', {
bubbles: true,
composed: true,
cancelable: true,
detail: {
value
}
}));
}
/**
* Processes the request by executing request actions and evaluating
Expand Down Expand Up @@ -491,6 +509,14 @@
console.warn(reason);
this._reportError(new Error(reason));
}

/**
* Dispatched when request is made. This is handled by `urlhistory-model`
* to store URL history data.
*
* @event url-history-store
* @param {String} value The URL to store.
*/
}
window.customElements.define(ArcRequestLogic.is, ArcRequestLogic);
</script>

0 comments on commit 76652e9

Please sign in to comment.