mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:41:34 +08:00
Byte pin type
This commit is contained in:
24
js/entity/ByteEntity.js
Executable file
24
js/entity/ByteEntity.js
Executable file
@@ -0,0 +1,24 @@
|
||||
import IntegerEntity from "./IntegerEntity"
|
||||
|
||||
export default class ByteEntity extends IntegerEntity {
|
||||
|
||||
static attributes = {
|
||||
value: 0,
|
||||
}
|
||||
|
||||
/** @param {Object | Number | String} values */
|
||||
constructor(values = 0) {
|
||||
super(values)
|
||||
/** @type {Number} */
|
||||
const value = Math.round(this.value)
|
||||
this.value = value >= 0 && value < 1 << 8 ? value : 0
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value.toString()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user