forked from rc/aircox
assets: add event pageLoaded
This commit is contained in:
parent
df9e3a9f61
commit
185fb57fd6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -136,6 +136,11 @@ export default class PageLoad {
|
||||||
history.pushState(state, '', url)
|
history.pushState(state, '', url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispatchPageLoaded(url) {
|
||||||
|
var evt = new CustomEvent("pageLoaded", {detail: url})
|
||||||
|
document.dispatchEvent(evt)
|
||||||
|
}
|
||||||
|
|
||||||
// --- events
|
// --- events
|
||||||
pageChanged(event) {
|
pageChanged(event) {
|
||||||
let submit = event.type == 'submit';
|
let submit = event.type == 'submit';
|
||||||
|
@ -161,7 +166,7 @@ export default class PageLoad {
|
||||||
else
|
else
|
||||||
options = {...options, method: target.method, body: formData}
|
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.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user