Skip to content

Commit d61ed9e

Browse files
committed
- Update README.md
- Add tests for custom jsify/dartify - Add tests checking identities of objects Currently identities are not retained Changes in marshalers/converters would be necessary to support this use case (and also deal with cyclical references!)
1 parent e8e9b4a commit d61ed9e

File tree

125 files changed

+42070
-34593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+42070
-34593
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ base class BigIntService {
197197

198198
As stated in a previous paragraph, code designed to run only on native platforms should not worry about data conversion. Because Squadron native workers share the same code and execute in `Isolate`s running in the same Dart VM, they never leave Dart's type-system. Data sent through Squadron is promoted from `dynamic` back to strong-types by simple cast operations.
199199

200-
On Web platforms, things are different because the data was handed over to the browser which down't know anything about Dart types:
200+
On Web platforms, things are different because the data was handed over to the browser which doesn't know anything about Dart types:
201201

202202
* `bool` and `String`: casting is enough to re-enter Dart's type system (handled by `CastConverter`).
203203

@@ -213,7 +213,7 @@ When lists and maps contain elements that cannot be cast, additional processing
213213

214214
Web Assembly requires extra-care.
215215
* **For instance, a `List<int>` object sent to a Web Assembly worker will be received as a `List<dynamic>` containing `double` elements!** Because `int` is not a subtype of `double` on Web Assembly runtimes, `list.cast<int>()` cannot be used. Under such circumstances, list elements must be processed individually and converted back; eg. `NumConverter` handles this specific example as `list.map(_toInt).toList()` where `_toInt` is a function that returns the input value as an `int` after checking it is effectively an `int` or an integral `double`.
216-
* **`Map<K,V>` objects sent to a Web Assembly worker will be received as a `Map<String,V>`!** See issue https://github.com/dart-lang/sdk/issues/57113. This is related to the current implementation of `jsify()` in `js_interop`, which Squadron relies on when sending data to the worker. A future version of Squadron might switch to a specific implementation in order to better support maps on Web platforms.
216+
* **`Map<K,V>` objects sent to a Web Assembly worker will be received as a `Map<String,V>`!** See issue https://github.com/dart-lang/sdk/issues/57113. This is related to the current implementation of `jsify()` in `js_interop`, which Squadron relies on when sending data to the worker. **This issue has been fixed in Squadron 6.2.0.**
217217

218218
For large collections or complex structures (nested lists/maps), this process may impact performance because 1/ `map()` will iterate over all elements and 2/ `toList()` will create a fresh list to hold the converted elements.
219219

dart_test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ compilers:
66
- dart2js
77
- dart2wasm
88

9-
js_trace: true
109
chain_stack_traces: true
1110
concurrency: 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<span><b>JavaScript Workers</b> compiled on <b>2025-01-12 18:01:10</b></span>
1+
<span><b>JavaScript Workers</b> compiled on <b>2025-01-26 12:12:39</b></span>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<span><b>Test Console</b> compiled on <b>2025-01-12 18:12:27</b></span>
1+
<span><b>Test Console</b> compiled on <b>2025-01-26 12:12:39</b></span>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<span><b>Web Assembly Workers</b> compiled on <b>2025-01-12 18:01:10</b></span>
1+
<span><b>Web Assembly Workers</b> compiled on <b>2025-01-26 12:12:39</b></span>

0 commit comments

Comments
 (0)