Skip to content

Commit 0063e92

Browse files
authored
Merge pull request #34 from rustwasm/Pauan-patch-1
Adding in note about how to handle Futures / Streams
2 parents 80ab491 + 6c20c5c commit 0063e92

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ Here is a checklist that all Gloo utility crates should fulfill:
115115
`FnOnce`) instead of taking `wasm_bindgen::Closure`s or
116116
`js_sys::Function`s directly.
117117

118+
* [ ] If the API can be implemented as a Future / Stream, then it should first be implemented as a callback, with the callback API put into the `callback` submodule.
119+
120+
Then the Future / Stream should be implemented using the callback API, and should be put into the `future` or `stream` submodule.
121+
122+
Make sure that the callback and Future / Stream APIs properly support cancellation (if it is possible to do so).
123+
118124
* [ ] Uses nice Rust-y types and interfaces instead of passing around untyped
119125
`JsValue`s.
120126

@@ -123,6 +129,12 @@ Here is a checklist that all Gloo utility crates should fulfill:
123129
escape hatch for dropping down to raw `web_sys` bindings when an API isn't
124130
fully supported by the crate yet.
125131

132+
* [ ] There is a loose hierarchy with "mid-level" APIs (which are essentially thin wrappers over the low-level APIs), and "high-level" APIs (which make more substantial changes).
133+
134+
As a general rule, the high-level APIs should be built on top of the mid-level APIs, which in turn should be built on top of the low-level APIs (e.g. `web_sys`)
135+
136+
There are exceptions to this, but they have to be carefully decided on a case-by-case basis.
137+
126138
* [ ] Headless browser and/or Node.js tests via `wasm-pack test`.
127139

128140
* [ ] Uses `#![deny(missing_docs, missing_debug_implementations)]`.

0 commit comments

Comments
 (0)