Skip to content

Cannot add custom layer to timeline #832

Open
@Radiergummi

Description

@Radiergummi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions