Minor refactoring of @hediet/debug-visualizer-data-extraction's API. Improved documentation.
This commit is contained in:
34
example-project/src/demo_custom-data-extractor.ts
Normal file
34
example-project/src/demo_custom-data-extractor.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import {
|
||||
registerDefaultDataExtractors,
|
||||
getDataExtractorApi,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
|
||||
// Registers all existing extractors.
|
||||
registerDefaultDataExtractors();
|
||||
|
||||
getDataExtractorApi().registerExtractor({
|
||||
id: "my-extractor",
|
||||
getExtractions: (data, collector) => {
|
||||
if (data instanceof Foo) {
|
||||
collector.addExtraction({
|
||||
id: "my-extractor",
|
||||
name: "My Extractor",
|
||||
priority: 2000,
|
||||
extractData: () => ({ kind: { text: true }, text: "Foo" }),
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
new Main().run();
|
||||
}, 0);
|
||||
|
||||
class Foo {}
|
||||
|
||||
class Main {
|
||||
run() {
|
||||
const f = new Foo();
|
||||
debugger;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
import {
|
||||
registerAll,
|
||||
CommonDataTypes,
|
||||
registerDefaultDataExtractors,
|
||||
createGraphFromPointers,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
|
||||
registerAll();
|
||||
registerDefaultDataExtractors();
|
||||
|
||||
setTimeout(() => {
|
||||
new Main().run();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as ts from "typescript";
|
||||
import { registerAll } from "@hediet/debug-visualizer-data-extraction";
|
||||
import { registerDefaultDataExtractors } from "@hediet/debug-visualizer-data-extraction";
|
||||
import { MockLanguageServiceHost } from "./MockLanguageServiceHost";
|
||||
|
||||
registerAll();
|
||||
registerDefaultDataExtractors();
|
||||
|
||||
setTimeout(() => {
|
||||
new Main().run();
|
||||
|
||||
Reference in New Issue
Block a user