Skip to content

Cannot add custom layer to timeline #832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Radiergummi opened this issue Mar 22, 2025 · 0 comments
Open

Cannot add custom layer to timeline #832

Radiergummi opened this issue Mar 22, 2025 · 0 comments

Comments

@Radiergummi
Copy link

Radiergummi commented Mar 22, 2025

I'm trying to add events for our API client to a custom timeline layer, but it won't appear. The plugin looks like so:

export const myPlugin = {
    install( app, options = {} ) {
        setupDevtoolsPlugin( {
            app,
            id: 'com.matchory.devtools',
            label: 'Matchory',
            logo: new URL( '/logo.svg', window.location.origin ).toString(),
            packageName: '@matchory/app',
        }, api => {
            const layerId = 'com.matchory.devtools.http';

            console.log( 'Devtools API is ready:', api );
            api.addTimelineLayer( {
                id: layerId,
                color: 0xff984f,
                label: 'API Events',
            } );

            window.addEventListener( 'api:response', ( event: CustomEvent ) => {
                console.log( 'HTTP response:', event );

                api.addTimelineEvent( {
                    layerId,
                    event: {
                        data: event.detail.toString(),
                        time: api.now(),
                        logType: 'default',
                        title: 'API Response',
                        subtitle: 'Received a response',
                        meta: {},
                    },
                } );
            } );
        } );
    },
} satisfies ObjectPlugin;

From everything I can gather from the documentation, this should definitely create a layer in the layer list, and record my event as it arrives. However, while both console.logs are logged to the console, the devtools neither pick up on my plugin, nor do they show the new layer, or record the event.

The v7 documentation looks like an early prototype that is still missing the actual content; it feels like there's something missing to register my plugin, but neither the old docs nor the new ones show me which.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant