another big refactor
This commit is contained in:
56
src/lib/observable/ObservableArray.hx
Normal file
56
src/lib/observable/ObservableArray.hx
Normal file
@@ -0,0 +1,56 @@
|
||||
package lib.observable;
|
||||
|
||||
class ObservableArray<T> extends ObservableValue<Array<T>> {
|
||||
public function new(value: Array<T>) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public function insert(pos: Int, x: T):Void {
|
||||
this.value.insert(pos,x);
|
||||
this.callbacks.invoke(this.value);
|
||||
}
|
||||
|
||||
public function pop(): Null<T> {
|
||||
var poped = this.pop();
|
||||
this.callbacks.invoke(this.value);
|
||||
return poped;
|
||||
}
|
||||
|
||||
public function push(x: T):Int {
|
||||
var i = this.value.push(x);
|
||||
this.callbacks.invoke(this.value);
|
||||
return i;
|
||||
}
|
||||
|
||||
public function remove(x: T): Bool {
|
||||
var b = this.value.remove(x);
|
||||
this.callbacks.invoke(this.value);
|
||||
return b;
|
||||
}
|
||||
|
||||
public function resize(len: Int) {
|
||||
this.value.resize(len);
|
||||
this.callbacks.invoke(this.value);
|
||||
}
|
||||
|
||||
public function reverse() {
|
||||
this.value.reverse();
|
||||
this.callbacks.invoke(this.value);
|
||||
}
|
||||
|
||||
public function shift(): Null<T> {
|
||||
var e = this.value.shift();
|
||||
this.callbacks.invoke(this.value);
|
||||
return e;
|
||||
}
|
||||
|
||||
public function sort(f:(T, T) -> Int):Void {
|
||||
this.value.sort(f);
|
||||
this.callbacks.invoke(this.value);
|
||||
}
|
||||
|
||||
public function unshift(x: T):Void {
|
||||
this.value.unshift(x);
|
||||
this.callbacks.invoke(this.value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user