@kymoscope/sdk 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ export interface LiveChartSource {
47
47
  * of in a step per received message. */
48
48
  latestT?: () => number;
49
49
  xAtTime?: (t: number) => number;
50
- /** The stream's id: a chart opened on it later starts with the waits this one learned (see learnedWaits). */
50
+ /** The stream's id: charts showing the same stream share one playout (see streamPlayout), so they show one instant. */
51
51
  id?: string;
52
52
  }
53
53
  /**
@@ -65,7 +65,8 @@ export interface Playout {
65
65
  }
66
66
  /** Seeded with `wait`: a stream's waits already learned (a chart opened on a stream others showed starts steady). */
67
67
  export declare function createPlayout(wait?: number): Playout;
68
- /** The waits learned per stream (LiveChartSource.id), for the next chart opened on it (a worksheet switch). */
69
- export declare const learnedWaits: Map<string, number>;
68
+ /** The display time of stream `id` given its newest sample time `t`, advanced once per frame (`now`: ms, a clock
69
+ * shared by every window, performance.now) however many charts ask in it. */
70
+ export declare function streamPlayout(id: string, t: number, now: number): number;
70
71
  /** Advance `p` one frame (`dtMs`, the real time since the last frame) given the newest sample time `t`; the display time. */
71
72
  export declare function advancePlayout(p: Playout, t: number, dtMs: number): number;
@@ -39,7 +39,7 @@ export declare class AnyWindowResizeObserver {
39
39
  * frame's time until the next frame, so several changes in one frame still
40
40
  * make one draw.
41
41
  */
42
- export declare function createDrawScheduler(draw: () => void, doc: () => Document | null | undefined): {
42
+ export declare function createDrawScheduler(draw: () => void, element: () => Element | null | undefined): {
43
43
  schedule(): void;
44
44
  now(): void;
45
45
  cancel(): void;
@@ -45,7 +45,9 @@ export interface OffscreenChartRenderer {
45
45
  setView(xmin: number, xmax: number, cut?: number): void;
46
46
  dispose(): void;
47
47
  }
48
- export declare function createOffscreenChartRenderer(canvas: HTMLCanvasElement, lineWidth?: number): OffscreenChartRenderer | null;
48
+ export declare function createOffscreenChartRenderer(canvas: HTMLCanvasElement, lineWidth?: number,
49
+ /** Its context was lost (Chrome dropped it): the caller makes a new canvas and renderer. */
50
+ onLost?: () => void): OffscreenChartRenderer | null;
49
51
  /**
50
52
  * The same renderer on the main thread through the page's shared WebGL
51
53
  * context (see sharedGl): for charts past the contexts a page may own. Each
@@ -14,6 +14,8 @@ export interface GlLease {
14
14
  shared: boolean;
15
15
  /** Copy what was just drawn into the chart's canvas (shared only; a no-op otherwise). */
16
16
  present(): void;
17
+ /** The shared context was lost (Chrome drops the oldest past its limit): a renderer on it must be made again. */
18
+ lost(): boolean;
17
19
  release(): void;
18
20
  }
19
21
  /** Whether a chart may still own a context (a worker of its own, say). */
@@ -21,10 +23,11 @@ export declare function canOwnGl(): boolean;
21
23
  /** Count a context a chart owns outside `leaseGl` (a worker's); returns its release. */
22
24
  export declare function ownGl(): () => void;
23
25
  /**
24
- * A context for the chart canvas `visible`: its own while the budget lasts,
25
- * else the shared one (the chart's canvas then shows copies through 2D).
26
+ * A context for the chart canvas `visible`: the shared one (the chart's canvas shows copies through 2D), which comes
27
+ * back when Chrome drops it; with `own`, its own while the budget lasts (lost for good if Chrome drops it: the
28
+ * canvas can't take another).
26
29
  */
27
- export declare function leaseGl(visible: HTMLCanvasElement): GlLease;
30
+ export declare function leaseGl(visible: HTMLCanvasElement, own?: boolean): GlLease;
28
31
  /** `make()` once per context and key. */
29
32
  export declare function cachedPerContext<T>(gl: WebGL2RenderingContext, key: string, make: () => T): T;
30
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kymoscope/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "The Kymoscope data engine and charts for the browser: import large measurement files, plot them, stream live data end-to-end encrypted.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://kymoscope.com/docs/introduction",