Skip to content

Commit

Permalink
📖 文档补充
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaubee committed Oct 10, 2024
1 parent 90359ac commit 4217fed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gaubee/util",
"version": "0.9.0",
"version": "0.9.1",
"tasks": {
"build": "deno run -A ./dnt.ts",
"npm": "deno task build && deno task pub-npm",
Expand Down
7 changes: 7 additions & 0 deletions src/readable_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ interface ReadableByteWithController {
<R>(strategy?: QueuingStrategy<R> & { type?: undefined }): ReadableDefaultStreamWithController<R>;
(strategy?: QueuingStrategy<Uint8Array> & { type: "bytes" }): ReadableByteStreamWithController;
}
/**
* 一个易用的 ReadableStream 构造函数
* - 直接暴露了 controller 对象
* - pull/cancel 使用 SharedFlow 来暴露
* @param strategy
* @returns
*/
const withController: ReadableByteWithController = <R>(strategy?: QueuingStrategy<R> & { type?: "bytes" }) => {
const result = obj_lazify<any>({
get onPull() {
Expand Down
2 changes: 1 addition & 1 deletion src/shared_flow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { iter_map_async } from "./collections.ts";
import { Func } from "./func.ts";
import type { Func } from "./func.ts";
import { type ReadableDefaultStreamWithController, rs_with_controller } from "./readable_stream.ts";

/** SharedFlow 的监听函数定义 */
Expand Down

0 comments on commit 4217fed

Please sign in to comment.