Skip to content

Commit

Permalink
Don't forward all functions in Signal.
Browse files Browse the repository at this point in the history
  • Loading branch information
player-03 committed Oct 7, 2024
1 parent b4d9947 commit 838bb8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/echoes/macro/ViewBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ class ViewBuilder {

private override function reset():Void {
super.reset();
onAdded.resize(0);
onRemoved.resize(0);
onAdded.clear();
onRemoved.clear();

//Remove this from all `_relatedViews` arrays.
$b{
Expand Down
6 changes: 5 additions & 1 deletion src/echoes/utils/Signal.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ package echoes.utils;
import haxe.macro.Expr;
#end

@:forward @:forward.new
@:forward(iterator, keyValueIterator, length, push, pop) @:forward.new
abstract Signal<T:haxe.Constraints.Function>(Array<T>) {
public inline function add(listener:T):Void {
this.push(listener);
}

public inline function clear():Void {
this.resize(0);
}

public function contains(listener:T):Bool {
for(l in this) {
if(Reflect.compareMethods(l, listener)) {
Expand Down

0 comments on commit 838bb8f

Please sign in to comment.