save state in FilePersistence
This commit is contained in:
@@ -117,12 +117,16 @@ export default class BinaryDecoder {
|
||||
*/
|
||||
readVarString () {
|
||||
let len = this.readVarUint()
|
||||
let bytes = new Array(len)
|
||||
let encodedString = ''
|
||||
//let bytes = new Array(len)
|
||||
for (let i = 0; i < len; i++) {
|
||||
bytes[i] = this.uint8arr[this.pos++]
|
||||
//bytes[i] = this.uint8arr[this.pos++]
|
||||
// encodedString += String.fromCodePoint(this.uint8arr[this.pos++])
|
||||
encodedString += String(this.uint8arr[this.pos++])
|
||||
}
|
||||
let encodedString = bytes.map(b => String.fromCodePoint(b)).join('')
|
||||
return decodeURIComponent(escape(encodedString))
|
||||
//let encodedString = String.fromCodePoint.apply(null, bytes)
|
||||
//return decodeURIComponent(escape(encodedString))
|
||||
return encodedString
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
// TODO: rename mutex
|
||||
|
||||
/**
|
||||
@@ -19,7 +18,7 @@
|
||||
*/
|
||||
export function createMutualExclude () {
|
||||
var token = true
|
||||
return function mutualExclude (f) {
|
||||
return function mutualExclude (f, g) {
|
||||
if (token) {
|
||||
token = false
|
||||
try {
|
||||
@@ -28,6 +27,8 @@ export function createMutualExclude () {
|
||||
console.error(e)
|
||||
}
|
||||
token = true
|
||||
} else if (g !== undefined) {
|
||||
g()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user