We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 381fcee commit 9179e9cCopy full SHA for 9179e9c
src/serverHistory.js
@@ -1,17 +1,19 @@
1
import {createLocation} from './util'
2
3
-function ServerHistory() {}
+function ServerHistory() {
4
+ this.listeners = []
5
+}
6
7
ServerHistory.prototype.listen = function listen(listener) {
- this.listener = listener
8
+ this.listeners.push(listener)
9
}
10
11
ServerHistory.prototype.push = function push(location) {
- const listener = this.listener
- if (!listener) {
12
+ const listeners = this.listeners
13
+ if (!listeners || listeners.length === 0) {
14
throw new Error('There is no active listener')
15
- listener(createLocation(location))
16
+ listeners.forEach(l => l(createLocation(location)))
17
18
19
ServerHistory.prototype.createHref = function createHref(path) {
0 commit comments