Custom Event
code-inspector-plugin dispatches a custom event code-inspector:trackCode whenever a feature is triggered. You can use it for analytics, logs, or custom integrations.
Event Shape
Event type: CustomEvent
Event name: code-inspector:trackCode
event.detail includes:
action: triggered feature, usuallylocate | copy | target | aielement: source info of the current element (such asname,path,line,column)
Example
js
window.addEventListener('code-inspector:trackCode', (event) => {
const { action, element } = event.detail || {};
if (!element) return;
const { name, path, line, column } = element;
console.log(`[code-inspector] action: ${action}`);
console.log(`[code-inspector] element: ${name} ${path}:${line}:${column}`);
sendLog('trackCode', {
action,
name,
path,
line,
column,
});
});