> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# plugin-window-events

De `@appsignal/plugin-window-events`-plug-in bindt zich aan de event handlers van `window.onerror` en `window.onunhandledrejection` om eventuele fouten op te vangen die elders in uw code niet worden opgevangen.

## Installatie

Voeg de pakketten `@appsignal/plugin-window-events` en `@appsignal/javascript` toe aan uw `package.json`-bestand en voer `yarn install`/`npm install` uit.

U kunt deze pakketten ook via de command line aan uw `package.json` toevoegen:

<CodeGroup>
  ```bash Bash theme={null}
  yarn add @appsignal/javascript @appsignal/plugin-window-events
  npm install @appsignal/javascript @appsignal/plugin-window-events
  ```
</CodeGroup>

## Gebruik

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { plugin } from `@appsignal/plugin-window-events`
  appsignal.use(plugin(options));
  ```

  ### Gebruik met Next.js

  Zelfs met `"use client"` rendert Next.js client-componenten op de server vooraf, waar het `window`-object niet beschikbaar is. Bescherm de initialisatie van de plug-in met:

  ```javascript JavaScript theme={null}
  if (typeof window !== "undefined") {
    appsignal.use(plugin(options));
  }
  ```
</CodeGroup>

## Opties voor `plugin`

De `plugin` kan met de volgende opties worden geïnitialiseerd:

| Param                | Type    | Beschrijving                                                                                                                                  |
| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| onerror              | Boolean | (optioneel) Een booleaanse waarde die aangeeft of de plug-in zich aan de `window.onerror`-handler moet binden. Standaard `true`.              |
| onunhandledrejection | Boolean | (optioneel) Een booleaanse waarde die aangeeft of de plug-in zich aan de `window.onunhandledrejection`-handler moet binden. Standaard `true`. |
