forked from rc/aircox
assets: add event pageLoaded
This commit is contained in:
@ -136,6 +136,11 @@ export default class PageLoad {
|
||||
history.pushState(state, '', url)
|
||||
}
|
||||
|
||||
dispatchPageLoaded(url) {
|
||||
var evt = new CustomEvent("pageLoaded", {detail: url})
|
||||
document.dispatchEvent(evt)
|
||||
}
|
||||
|
||||
// --- events
|
||||
pageChanged(event) {
|
||||
let submit = event.type == 'submit';
|
||||
@ -161,7 +166,7 @@ export default class PageLoad {
|
||||
else
|
||||
options = {...options, method: target.method, body: formData}
|
||||
}
|
||||
this.load(url, options).then(() => this.historySave(url))
|
||||
this.load(url, options).then(() => this.dispatchPageLoaded(url)).then(() => this.historySave(url))
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
Reference in New Issue
Block a user