---
title: KeepAwake
description: A running keepalive. Call stop() when the work is done; done() resolves when it ends on its own. A garbage-collected handle stops the keepalive.
---

A running keepalive. Call `stop()` when the work is done; `done()` resolves when it
ends on its own. A garbage-collected handle stops the keepalive.

## Accessors

### running

#### Get Signature

```ts
get running(): boolean;
```

Whether the keepalive is still polling.

##### Returns

`boolean`

## Methods

### done()

```ts
done(): Promise<KeepAwakeReport>;
```

Resolves when the keepalive ends (`whileBusy`, `maxDurationSec`, or `stop()`).

#### Returns

`Promise`\<[`KeepAwakeReport`](/microvms-agentd/reference/typescript/interfaces/keepawakereport/)>

***

### stop()

```ts
stop(): Promise<KeepAwakeReport>;
```

Stops polling and resolves with the report; rejects with the error that ended it.

#### Returns

`Promise`\<[`KeepAwakeReport`](/microvms-agentd/reference/typescript/interfaces/keepawakereport/)>

## Provenance

This page is generated from `bindings/microvms-js/index.d.ts` by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run dts`. `mise run dts:check` fails when the committed file no longer matches the source.