Loading spinner for videos
Only worked for audio before
This commit is contained in:
@@ -4,6 +4,7 @@ function LocationHistory () {
|
||||
if (!new.target) return new LocationHistory()
|
||||
this._history = []
|
||||
this._forward = []
|
||||
this._pending = null
|
||||
}
|
||||
|
||||
LocationHistory.prototype.go = function (page) {
|
||||
@@ -13,9 +14,12 @@ LocationHistory.prototype.go = function (page) {
|
||||
}
|
||||
|
||||
LocationHistory.prototype._go = function (page) {
|
||||
if (this._pending) return
|
||||
if (page.onbeforeload) {
|
||||
this._pending = page
|
||||
page.onbeforeload((err) => {
|
||||
if (err) return
|
||||
this._pending = null
|
||||
this._history.push(page)
|
||||
})
|
||||
} else {
|
||||
@@ -59,3 +63,7 @@ LocationHistory.prototype.hasBack = function () {
|
||||
LocationHistory.prototype.hasForward = function () {
|
||||
return this._forward.length > 0
|
||||
}
|
||||
|
||||
LocationHistory.prototype.pending = function () {
|
||||
return this._pending
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user