From dfb3a2d260dad49806e1c357c806bff469c7ee3e Mon Sep 17 00:00:00 2001 From: Peter Kimberley Date: Sun, 31 Mar 2019 13:51:20 +1100 Subject: [PATCH 1/3] Add _destructor() method --- types/force-graph/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/force-graph/index.d.ts b/types/force-graph/index.d.ts index b9b056ce04..7d85884357 100644 --- a/types/force-graph/index.d.ts +++ b/types/force-graph/index.d.ts @@ -74,7 +74,9 @@ declare namespace ForceGraph { */ interface ForceGraphInstance { + // Init / de-init (element: HTMLElement): ForceGraphInstance; + _destructor(): void; // Data input graphData(data?: GraphData): ForceGraphInstance & GraphData; From 7b3781ebfa0d6036675f681df541c0f01467ab81 Mon Sep 17 00:00:00 2001 From: Peter Kimberley Date: Sun, 31 Mar 2019 13:52:06 +1100 Subject: [PATCH 2/3] Update supported package version comment --- types/force-graph/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/force-graph/index.d.ts b/types/force-graph/index.d.ts index 7d85884357..9f14fa2064 100644 --- a/types/force-graph/index.d.ts +++ b/types/force-graph/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for force-graph >= 1.14 +// Type definitions for force-graph 1.14.4 // Project: https://github.com/vasturiano/force-graph // Definitions by: Peter Kimberley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From f1329ea9f82e4a2aab386cd342170abe43b709c5 Mon Sep 17 00:00:00 2001 From: Peter Kimberley Date: Sun, 31 Mar 2019 13:58:13 +1100 Subject: [PATCH 3/3] Update usage example --- types/force-graph/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/force-graph/index.d.ts b/types/force-graph/index.d.ts index 9f14fa2064..b78737e74e 100644 --- a/types/force-graph/index.d.ts +++ b/types/force-graph/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for force-graph 1.14.4 +// Type definitions for force-graph 1.14 // Project: https://github.com/vasturiano/force-graph // Definitions by: Peter Kimberley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -68,9 +68,13 @@ declare namespace ForceGraph { /** * Represents ForceGraph runtime object * @example: + * // Create an empty ForceGraph instance on an existing DOM element * let forceGraph = ForceGraph(); * forceGraph(myHtmlElement); - * forceGraph.graphData([]) + * forceGraph.graphData([]); + * + * // Destroy the ForceGraph instance + * forceGraph._destructor(); */ interface ForceGraphInstance {