Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCUMENTATION: improve documentation for atExit() #1916

Merged
merged 2 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions markdown/bitburner.ns.atexit.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## NS.atExit() method

Add callback function when the script dies
Add a callback to be executed when the script dies.

**Signature:**

Expand All @@ -16,8 +16,8 @@ atExit(f: () => void, id?: string): void;

| Parameter | Type | Description |
| --- | --- | --- |
| f | () => void | |
| id | string | _(Optional)_ |
| f | () => void | A function to execute when the script dies. |
| id | string | _(Optional)_ Callback ID. Optional, defaults to <code>&quot;default&quot;</code>. |

**Returns:**

Expand All @@ -29,5 +29,5 @@ RAM cost: 0 GB

NS2 exclusive

Add callback to be executed when the script dies.
Each script can only register one callback per callback ID. If another callback is registered with the same callback ID the previous callback with that ID is forgotten and will not be executed when the script dies.

2 changes: 1 addition & 1 deletion markdown/bitburner.ns.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function main(ns) {
| --- | --- |
| [alert(msg)](./bitburner.ns.alert.md) | Open up a message box. |
| [asleep(millis)](./bitburner.ns.asleep.md) | Suspends the script for n milliseconds. Doesn't block with concurrent calls. |
| [atExit(f, id)](./bitburner.ns.atexit.md) | Add callback function when the script dies |
| [atExit(f, id)](./bitburner.ns.atexit.md) | Add a callback to be executed when the script dies. |
| [brutessh(host)](./bitburner.ns.brutessh.md) | Runs BruteSSH.exe on a server. |
| [clear(handle)](./bitburner.ns.clear.md) | Clear data from a file. |
| [clearLog()](./bitburner.ns.clearlog.md) | Clears the script’s logs. |
Expand Down
2 changes: 0 additions & 2 deletions markdown/bitburner.ns.settailfontsize.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ RAM cost: 0 GB

This overwrites the tail font size and forces an update of the tail window's contents.

The font size is saved across restarts.

If ran without a filename or pid, this will affect the current script's tail window.

Otherwise, the PID or filename, hostname/ip, and args… arguments can be used to target the tail window from another script. Remember that scripts are uniquely identified by both their names and arguments.
Expand Down
9 changes: 7 additions & 2 deletions src/ScriptEditor/NetscriptDefinitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7905,13 +7905,18 @@ export interface NS {
getMoneySources(): MoneySources;

/**
* Add callback function when the script dies
* Add a callback to be executed when the script dies.
* @remarks
* RAM cost: 0 GB
*
* NS2 exclusive
*
* Add callback to be executed when the script dies.
* Each script can only register one callback per callback ID.
* If another callback is registered with the same callback ID
* the previous callback with that ID is forgotten and will not be executed when the script dies.
*
* @param f - A function to execute when the script dies.
* @param id - Callback ID. Optional, defaults to `"default"`.
*/
atExit(f: () => void, id?: string): void;

Expand Down
Loading