MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / testCallableAPI

Function testCallableAPI

packages/sdks/web/src/types.debug.ts:3–18  ·  view source on GitHub ↗

biome-ignore-all lint/correctness/noUnusedVariables: test

()

Source from the content-addressed store, hash-verified

1// Test callable function API
2/** biome-ignore-all lint/correctness/noUnusedVariables: test */
3function testCallableAPI() {
4 // ✅ Should work - correct callable syntax
5 window.op('track', 'button_clicked', { location: 'header' });
6 window.op('identify', { profileId: 'user123', email: 'test@example.com' });
7 window.op('init', { clientId: 'test-client-id' });
8 window.op('screenView', '/page', { title: 'Test Page' });
9 window.op('setGlobalProperties', { version: '1.0.0' });
10
11 // ❌ Should error - wrong method name
12 // @ts-expect-error - 'invalidMethod' is not a valid method
13 window.op('invalidMethod', 'test');
14
15 // ❌ Should error - wrong arguments for track
16 // @ts-expect-error - track expects (name: string, properties?: TrackProperties)
17 window.op('track', 123);
18}
19
20// Test direct method API
21function testDirectMethodAPI() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected