Add experiments folder. Add usage.md and SKILL.md. Fix Sheet interactions and add dynamic sheet mode.
This commit is contained in:
44
apps/demo/src/compatibility-lab.ts
Normal file
44
apps/demo/src/compatibility-lab.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { reactive, type InjectionKey, type Ref } from "vue";
|
||||
|
||||
export interface CompatibilityLabEvent {
|
||||
id: number;
|
||||
timestamp: string;
|
||||
source: string;
|
||||
hook: string;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export interface CompatibilityLabContext {
|
||||
source: string;
|
||||
routeLabel: Readonly<Ref<string>>;
|
||||
}
|
||||
|
||||
export const demoAppValueKey: InjectionKey<string> = Symbol("demo-app-value");
|
||||
export const compatibilityLabContextKey: InjectionKey<CompatibilityLabContext> =
|
||||
Symbol("compatibility-lab-context");
|
||||
|
||||
let eventSequence = 0;
|
||||
const startedAt = performance.now();
|
||||
|
||||
export const compatibilityLab = reactive({
|
||||
events: [] as CompatibilityLabEvent[],
|
||||
});
|
||||
|
||||
export function recordCompatibilityEvent(
|
||||
source: string,
|
||||
hook: string,
|
||||
detail?: string,
|
||||
) {
|
||||
compatibilityLab.events.unshift({
|
||||
id: ++eventSequence,
|
||||
timestamp: `${(performance.now() - startedAt).toFixed(0)} ms`,
|
||||
source,
|
||||
hook,
|
||||
detail,
|
||||
});
|
||||
if (compatibilityLab.events.length > 120) compatibilityLab.events.splice(120);
|
||||
}
|
||||
|
||||
export function clearCompatibilityEvents() {
|
||||
compatibilityLab.events.splice(0);
|
||||
}
|
||||
Reference in New Issue
Block a user