mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||
|
|
||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [nextUpdate](./bitburner.corporation.nextupdate.md)
|
||
|
|
||
|
## Corporation.nextUpdate() method
|
||
|
|
||
|
Sleep until the next Corporation update has happened.
|
||
|
|
||
|
**Signature:**
|
||
|
|
||
|
```typescript
|
||
|
nextUpdate(): Promise<CorpStateName>;
|
||
|
```
|
||
|
**Returns:**
|
||
|
|
||
|
Promise<[CorpStateName](./bitburner.corpstatename.md)<!-- -->>
|
||
|
|
||
|
Promise that resolves to the name of the state that was just processed.
|
||
|
|
||
|
I.e. when the state is PURCHASE, it means purchasing has just happened. Note that this is the state just before `getCorporation().state`<!-- -->.
|
||
|
|
||
|
Possible states are START, PURCHASE, PRODUCTION, EXPORT, SALE.
|
||
|
|
||
|
## Remarks
|
||
|
|
||
|
RAM cost: 1 GB
|
||
|
|
||
|
The amount of real time spent asleep between updates can vary due to "bonus time" (usually 200 milliseconds - 2 seconds).
|
||
|
|
||
|
## Example
|
||
|
|
||
|
|
||
|
```js
|
||
|
while (true) {
|
||
|
const prevState = await ns.corporation.nextUpdate();
|
||
|
const nextState = ns.corporation.getCorporation().state;
|
||
|
ns.print(`Corporation finished with ${prevState}, next will be ${nextState}.`);
|
||
|
// Manage the Corporation
|
||
|
}
|
||
|
```
|
||
|
|