Skip to main content

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

NameTypeRequiredDescription
eventkeyof AppsInTossEventEvent name to subscribe. No events are defined in the current SDK version.
handlers.onEventfunctionHandler called when the event fires.
handlers.onErrorfunctionHandler called on error.
handlers.optionsEvent-specific options.

Returns

  • () => void — cleanup function that unsubscribes. Use as the useEffect return 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-example

External references