From f0f54b19b95b1de1e167d15dcd5cf48da4e15237 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Tue, 18 May 2021 08:44:47 -0700 Subject: [PATCH] Added basic chart to demo Summary: Added demo to show how DataSource can power charts using event sampling and smart windowing. A more experimental application: use dataSource to power some charts, that leverages the events emitted from an datasource that is continuously being appended: - incoming events are downsampled 1 in 100 to build up the bottom window - incoming events are not downsampled to render the topwindow, but since datasource views will ignore events outside the window, things will stay pretty responsive when a window is selected (without a window, the downsampled dataset is used as source for top chart as well). Compared to a naive (well still slightly optimised with useFastArray) implementation that throws all incoming event in a big array, it performs > 20 times faster (see difference in amount of events processed) Reviewed By: passy Differential Revision: D28474409 fbshipit-source-id: 6a7973d1ade3053b1d6c8f72069697d96b1ef4fd --- desktop/flipper-plugin/src/data-source/DataSource.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/desktop/flipper-plugin/src/data-source/DataSource.tsx b/desktop/flipper-plugin/src/data-source/DataSource.tsx index b11dfa7ba..53cc21765 100644 --- a/desktop/flipper-plugin/src/data-source/DataSource.tsx +++ b/desktop/flipper-plugin/src/data-source/DataSource.tsx @@ -489,9 +489,7 @@ class DataSourceView { this.windowEnd = end; } - public setListener( - listener: typeof DataSourceView['prototype']['outputChangeListener'], - ) { + public setListener(listener?: (change: OutputChange) => void) { if (this.outputChangeListener && listener) { console.warn('outputChangeListener already set'); }