-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
134c825
commit 1f9d788
Showing
5 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
/** @license MIT License (c) copyright 2010-2017 original author or authors */ | ||
import { curry3 } from '@most/prelude' | ||
|
||
// Try to dispose the disposable. If it throws, send | ||
// the error to sink.error with the provided Time value | ||
export function tryDispose (t, disposable, sink) { | ||
export const tryDispose = curry3((t, disposable, sink) => { | ||
try { | ||
disposable.dispose() | ||
} catch (e) { | ||
sink.error(t, e) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import { Time, Disposable, Sink } from '@most/types'; | ||
|
||
declare function disposeNone (): Disposable; | ||
|
||
declare function disposeWith <R> (dispose: (resource: R) => void, resource: R): Disposable; | ||
declare function disposeWith <R> (dispose: (resource: R) => void): (resource: R) => Disposable | ||
|
||
declare function disposeOnce (d: Disposable): Disposable; | ||
|
||
declare function disposeBoth (d1: Disposable, d2: Disposable): Disposable; | ||
declare function disposeBoth (d1: Disposable): (d2: Disposable) => Disposable | ||
|
||
declare function disposeAll (ds: Array<Disposable>): Disposable; | ||
|
||
declare function tryDispose (t: Time, disposable: Disposable, sink: Sink<any>): void; | ||
declare function tryDispose (t: Time, disposable: Disposable, sink: Sink<any>): void | ||
declare function tryDispose (t: Time): (disposable: Disposable, sink: Sink<any>) => void | ||
declare function tryDispose (t: Time, disposable: Disposable): (sink: Sink<any>) => void | ||
declare function tryDispose (t: Time): (disposable: Disposable) => (sink: Sink<any>) => void |