Skip to content

Commit

Permalink
Docs tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Jul 17, 2024
1 parent 3816ccc commit 5e0c227
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/content/runtime/concepts/albums.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Photo Albums
title: Albums
description: Working with the screenshot / video albums
---

Expand Down
6 changes: 3 additions & 3 deletions docs/content/runtime/concepts/file-system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ instances of `Switch.FsFile`.

### Read as JSON

Reading and parsing a JSON file is a one-liner:
Reading and parsing a JSON file is a one-liner via the [`json()`](/runtime/api/namespaces/Switch/classes/FsFile#json) function:

```typescript
const topScores = await Switch.file('sdmc:/top-scores.json').json();
Expand All @@ -37,8 +37,8 @@ console.log(topScores);

### Readable stream

`Switch.FsFile` allows you to read a file using the web ReadableStream API, by invoking the `stream()`
function which returns a ReadableStream instance:
To read a file using the [Web Streams API](https://developer.mozilla.org/docs/Web/API/Streams_API), invoke the [`stream()`](/runtime/api/namespaces/Switch/classes/FsFile#stream)
function which returns a [`ReadableStream`](/runtime/api/classes/ReadableStream) instance:

```typescript
for await (const chunk of Switch.file('sdmc:/data.txt').stream()) {
Expand Down
6 changes: 4 additions & 2 deletions docs/content/runtime/concepts/profiles.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: User Profiles
title: Profiles
description: Interacting with user profiles
---

Expand All @@ -20,6 +20,7 @@ You may _set_ the `Switch.Profile.current` property to force the "current" profi
the specified profile. Doing so will prevent the user selection modal from being
shown when accessing [`localStorage`](/runtime/api/variables/localStorage).

> [!NOTE]
> The `localStorage` API utilizes this value to determine which user profile to associate the data with.

Expand All @@ -40,7 +41,8 @@ if (profile) {
}
```

> The user selection modal is _synchronous_, so it will __block the application event loop__
> [!WARNING]
> The user selection modal is _synchronous_, so it will __block the event loop__
> until the user selects a profile.
## Iterate user profiles
Expand Down
1 change: 1 addition & 0 deletions docs/content/runtime/rendering/canvas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ to draw to the screen.
The global `screen` object is used to create a `CanvasRenderingContext2D`
instance, at which point the app is in __canvas rendering__ mode.

> [!IMPORTANT]
> You should avoid using any `console` printing functions when in __canvas rendering__ mode.
> Doing so will change the app back to [__console rendering__](/runtime/rendering/console) mode.
Expand Down
7 changes: 4 additions & 3 deletions docs/content/runtime/rendering/console.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ description: Logging to the Console for text based applications
---

If your application is purely text-based, you can use the familiar
`console` global to write textual data to the screen of the application
global `console` object to write textual data to the screen of the application
in the terminal-like interface that [`libnx`](https://github.com/switchbrew/libnx) provides.

> To draw more intricate graphics, you should use the [Canvas API](/runtime/rendering/canvas).
> [!TIP]
> To draw more intricate graphics, you should use [__canvas rendering__](/runtime/rendering/canvas) mode.
## Example

Expand All @@ -17,7 +18,7 @@ console.log('Hello World');

## ANSI Escape Codes

Listed below is a (non-exhaustive) list of npm modules known to work well with nx.js when using the Console renderer:
Listed below is a (non-exhaustive) list of npm modules known to work well with nx.js when using console rendering mode:

* [`kluer`](https://github.com/lukeed/kleur) - Output colored text with ANSI escape codes
* [`sisteransi`](https://github.com/terkelg/sisteransi) - ANSI escape sequences for moving the cursor
Expand Down

0 comments on commit 5e0c227

Please sign in to comment.