refactor the whole damn thing
This commit is contained in:
24
src/Struct/ItemString.js
Normal file
24
src/Struct/ItemString.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import Item from './Item'
|
||||
|
||||
export default class ItemString extends Item {
|
||||
constructor () {
|
||||
super()
|
||||
this._content = null
|
||||
}
|
||||
get _length () {
|
||||
return this._content.length
|
||||
}
|
||||
_fromBinary (y, decoder) {
|
||||
let missing = super._fromBinary(y, decoder)
|
||||
this._content = decoder.readVarString()
|
||||
return missing
|
||||
}
|
||||
_toBinary (y, encoder) {
|
||||
super._toBinary(y, encoder)
|
||||
encoder.writeVarString(this._content)
|
||||
}
|
||||
_logString () {
|
||||
let s = super._logString()
|
||||
return 'ItemString: ' + s
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user