*** id: bfb38459-dc3c-4f49-856d-c95a1f6de902 title: once slug: /js/reference/pubsub/client/once description: once method for the PubSub.Client class. max-toc-depth: 3 ---------------- ### once * **once**(`event`, `fn`) Attaches an event handler to the specified event. The handler will fire only once. #### Parameters | Name | Type | Description | | :------ | :------- | :--------------------------------------------------------------------------------------------------- | | `event` | `string` | Name of the event. See the list of [events](/docs/browser-sdk/v3/js/reference/pubsub/client/events). | | `fn` | Function | An event handler. |