Skip to content

Commit c29c4eb

Browse files
docs: blob and url ts polyfill
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent 0a0df85 commit c29c4eb

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

  • docs/reference/functions/typescript

docs/reference/functions/typescript/node.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ The TypeScript runtime used in Juno does not provide full Node.js support. Polyf
44

55
If you require a specific Node.js feature or are blocked by a missing polyfill, please reach out or open an issue. Features are prioritized based on usage and compatibility.
66

7-
---
8-
9-
## Globals
7+
The following globals are available out of the box, without any imports.
108

11-
Some global functions are supported but come with important limitations or added details.
9+
---
1210

13-
### Math.random
11+
## Math.random
1412

15-
Generates a pseudo-random number between 0 (inclusive) and 1 (exclusive) is supported.
13+
Generates a pseudo-random number between 0 (inclusive) and 1 (exclusive).
1614

1715
However, the generator is seeded once after upgrade of the Satellite. Use it with caution.
1816

@@ -28,11 +26,34 @@ const value = Math.random();
2826

2927
---
3028

31-
### Console
29+
## Console
3230

3331
Logging is fully supported. Objects are stringified and logs are routed to the IC-CDK `print()` function, making them visible in your Satellite logs including inside the Juno Console UI in development or production.
3432

3533
```typescript
3634
console.log("Hello from the Satellite");
3735
console.info("Hello", { type: "info", msg: "Something happened" });
3836
```
37+
38+
---
39+
40+
## Blob
41+
42+
`Blob` represents immutable raw binary data.
43+
44+
```typescript
45+
const blob = new Blob(["Hello from the Satellite"], { type: "text/plain" });
46+
const text = await blob.text();
47+
```
48+
49+
---
50+
51+
## URL
52+
53+
Parses and manipulates URLs with `URL` and `URLSearchParams`.
54+
55+
```typescript
56+
const url = new URL("https://example.com?foo=bar");
57+
console.log(url.hostname); // example.com
58+
console.log(url.searchParams.get("foo")); // bar
59+
```

0 commit comments

Comments
 (0)