appsInTossEvent.addEventListener
Subscribes to Apps in Toss platform-specific events. In the current SDK version (2.5.0), the AppsInTossEvent type is an empty object — no subscribable events are defined yet. This namespace is reserved for future platform event expansion.
Signature
import { appsInTossEvent } from '@apps-in-toss/web-framework';
type AppsInTossEvent = {};
declare const appsInTossEvent: {
addEventListener: <K extends keyof AppsInTossEvent>(
event: K,
handlers: {
onEvent: AppsInTossEvent[K]['onEvent'];
onError?: AppsInTossEvent[K]['onError'];
options?: AppsInTossEvent[K]['options'];
}
) => () => void;
};
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
event | keyof AppsInTossEvent | ✓ | Event name to subscribe. No events are defined in the current SDK version. |
handlers.onEvent | function | ✓ | Handler called when the event fires. |
handlers.onError | function | — | Handler called on error. |
handlers.options | — | — | Event-specific options. |
Returns
() => void— cleanup function that unsubscribes. Use as theuseEffectreturn value.
Permission
No permission required — appsInTossEvent.addEventListener is not bound to a PermissionName.
Examples
Minimal
AppsInTossEvent has no events defined currently — this illustrates the subscription structure for when events are added.
import { appsInTossEvent } from '@apps-in-toss/web-framework';
import { useEffect } from 'react';
function Page() {
useEffect(() => {
// AppsInTossEvent is currently an empty type.
// Add subscriptions here when platform events are introduced.
// const cleanup = appsInTossEvent.addEventListener('someEvent', { onEvent: () => {} });
// return cleanup;
}, []);
return <main>{/* page content */}</main>;
}
Try it live
Open in sdk-exampleRelated APIs
graniteEvent.addEventListener— subscribe tobackEvent,homeEvent.tdsEvent.addEventListener— subscribe tonavigationAccessoryEvent.onVisibilityChangedByTransparentServiceWeb— subscribe to visibility changes.
Related guides
- Guides — Event subscription patterns — addEventListener shape, cleanup, comparison across the three domains, and anti-patterns.
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.