-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(rstream): major pkg restructure
- flatten /src folder for easier imports in userland - move logging from api.ts => logger.ts - rename internal helpers (__nextID, __optsWithID, defWorker, ...) - update imports
- Loading branch information
1 parent
18ae2f7
commit 831c113
Showing
40 changed files
with
268 additions
and
261 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
4 changes: 2 additions & 2 deletions
4
packages/rstream/src/subs/asidechain.ts → packages/rstream/src/asidechain.ts
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,5 +1,13 @@ | ||
import { implementsFunction } from "@thi.ng/checks/implements-function"; | ||
import type { ISubscribable } from "./api"; | ||
import { CloseMode, ISubscribable } from "./api"; | ||
|
||
export const isSubscribable = (x: any): x is ISubscribable<any> => | ||
implementsFunction(x, "subscribe"); | ||
|
||
/** | ||
* Returns true if mode is FIRST, or if mode is LAST *and* `num = 0`. | ||
* | ||
* @internal | ||
*/ | ||
export const isFirstOrLastInput = (mode: CloseMode, num: number) => | ||
mode === CloseMode.FIRST || (mode === CloseMode.LAST && !num); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const defInlineWorker = (src: string) => | ||
defWorker(new Blob([src], { type: "text/javascript" })); | ||
|
||
export const defWorker = (worker: Worker | string | Blob) => | ||
worker instanceof Worker | ||
? worker | ||
: new Worker( | ||
worker instanceof Blob ? URL.createObjectURL(worker) : worker | ||
); |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { CommonOpts } from "./api"; | ||
|
||
let NEXT_ID = 0; | ||
|
||
export const __nextID = () => NEXT_ID++; | ||
|
||
/** | ||
* @param prefix | ||
* @param opts | ||
* | ||
* @internal | ||
*/ | ||
export const __optsWithID = <T extends CommonOpts>( | ||
prefix: string, | ||
opts?: Partial<T> | ||
) => | ||
<Partial<T>>( | ||
(!opts || !opts.id ? { ...opts, id: prefix + "-" + __nextID() } : opts) | ||
); |
Oops, something went wrong.