add Time, reducing some duplication
This commit is contained in:
parent
e737015d7e
commit
b6999e4f1f
7 changed files with 70 additions and 85 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import Time from '../common/Time.js'
|
||||
|
||||
/**
|
||||
* Wrapper around ws that
|
||||
* - buffers 'send' until a connection is available
|
||||
|
|
@ -48,12 +50,12 @@ export default class WsWrapper {
|
|||
}
|
||||
ws.onerror = (e) => {
|
||||
this.handle = null
|
||||
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1000)
|
||||
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1 * Time.SEC)
|
||||
this.onclose(e)
|
||||
}
|
||||
ws.onclose = (e) => {
|
||||
this.handle = null
|
||||
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1000)
|
||||
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1 * Time.SEC)
|
||||
this.onclose(e)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue