Reactively
Reactively is a library for fine grained reactive programming.
See documentation
for details.
This part of the library (@reactively/decorate
)
contains annotations for using reactively in classes.
class ResizeableBuffer extends HasReactive {
@reactively size = 0;
@reactively get blocks() { return Math.ceil(this.size / 2 ** 12); }
@reactively get buffer(): any {
const newBuf = Buffer.allocUnsafe(this.blocks * 2 ** 12);
this._buf && newBuf.copy(this._buf);
return (this._buf = newBuf);
}
private _buf: any;
}
const b = new ResizeableBuffer();
b.size = 10 ** 5;
b.buffer.fill(-1);
b.buffer.setAt(0, 100);
b.size += 1;
b.buffer;