Skip to content

Commit

Permalink
Remove some deprecated stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
back2dos committed Jun 6, 2023
1 parent d8a0ba6 commit c693cf3
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions src/tink/state/Observable.hx
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package tink.state;

private typedef BindingOptions<T> = Deprecated<{
?direct:Bool,
?comparator:T->T->Bool,
}>;

@:forward
abstract Deprecated<T>(T) {
@:deprecated
@:from static function of<X>(v:X):Deprecated<X>
return cast v;
}

/**
Common representation of a piece of observable state. It can be read using the `value` property
and bound to listen for changes using the `bind` method.
Expand Down Expand Up @@ -56,16 +44,7 @@ abstract Observable<T>(ObservableObject<T>) from ObservableObject<T> to Observab
You can customize this behaviour by passing a different `scheduler` and `comparator` instances
to this function.
**/
public function bind(
#if tink_state.legacy_binding_options ?options:BindingOptions<T>, #end
callback:Callback<T>, ?comparator:Comparator<T>, ?scheduler:Scheduler
):CallbackLink {
#if tink_state.legacy_binding_options
if (options != null) {
comparator = options.comparator;
if (options.direct) scheduler = Scheduler.direct;
}
#end
public function bind(callback:Callback<T>, ?comparator:Comparator<T>, ?scheduler:Scheduler):CallbackLink {
if (scheduler == null)
scheduler = Observable.scheduler;
return Binding.create(this, callback, scheduler, comparator);
Expand Down Expand Up @@ -121,18 +100,6 @@ abstract Observable<T>(ObservableObject<T>) from ObservableObject<T> to Observab
public function mapAsync<R>(f:Transform<T, Promise<R>>):Observable<Promised<R>>
return Observable.auto(() -> f.apply(this.getValue()));

@:deprecated('use auto instead')
public function switchSync<R>(cases:Array<{ when: T->Bool, then: Lazy<Observable<R>> } > , dfault:Lazy<Observable<R>>):Observable<R>
return Observable.auto(() -> {
var v = value;
for (c in cases)
if (c.when(v)) {
dfault = c.then;
break;
}
return dfault.get().value;
});

static var scheduler:Scheduler =
#if macro
Scheduler.direct;
Expand Down

0 comments on commit c693cf3

Please sign in to comment.