From caafcbc990c135f8c7720513c38f6128794b9656 Mon Sep 17 00:00:00 2001 From: MaceWindu Date: Wed, 26 Mar 2014 21:44:54 +0100 Subject: [PATCH] a bit more definitions for jsPlumb. Still, this file miss a lot of definitions from jsPlumb --- jsplumb/jquery.jsPlumb.d.ts | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/jsplumb/jquery.jsPlumb.d.ts b/jsplumb/jquery.jsPlumb.d.ts index ed7bc8452..ffa26eea8 100644 --- a/jsplumb/jquery.jsPlumb.d.ts +++ b/jsplumb/jquery.jsPlumb.d.ts @@ -5,7 +5,9 @@ /// -interface jsPlumb { +declare var jsPlumb: jsPlumbInstance; + +interface jsPlumbInstance { setRenderMode(renderMode: string): string; bind(event: string, callback: (e) => void ): void; unbind(event?: string): void; @@ -17,16 +19,26 @@ interface jsPlumb { addEndpoint(ep: string): any; removeClass(el: any, clazz: string): void; hasClass(el: any, clazz: string): void; - draggable(el: any, container?: DragContainer): void; - connect(connection: ConnectParams): void; + draggable(el: string, options?: DragOptions): jsPlumbInstance; + draggable(ids: string[], options?: DragOptions): jsPlumbInstance; + connect(connection: ConnectParams, referenceParams?: ConnectParams): Connection; makeSource(el: string, options: SourceOptions): void; makeTarget(el: string, options: TargetOptions): void; repaintEverything(): void; detachEveryConnection(): void; detachAllConnections(el: string): void; - removeAllEndpoints(el: any): void; + removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance; + removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance; select(params: SelectParams): Connections; - getConnections(options?: any, flat?: any): any[]; + getConnections(options?: any, flat?: any): any[]; + deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance; + deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance; + repaint(el: string): jsPlumbInstance; + repaint(el: Element): jsPlumbInstance; + + SVG: string; + CANVAS: string; + VML: string; } interface Defaults { @@ -36,6 +48,8 @@ interface Defaults { ConnectionsDetachable?: boolean; ReattachConnections?: boolean; ConnectionOverlays?: any[][]; + Container?: any; // string(selector or id) or element + DragOptions?: DragOptions; } interface PaintStyle { @@ -62,8 +76,8 @@ interface Connections { } interface ConnectParams { - source: string; - target: string; + source?: any; // string, element or endpoint + target?: any; // string, element or endpoint detachable?: boolean; deleteEndpointsOnDetach?: boolean; endPoint?: string; @@ -72,8 +86,8 @@ interface ConnectParams { label?: string; } -interface DragContainer { - containment: string; +interface DragOptions { + containment?: string; } interface SourceOptions { @@ -103,3 +117,12 @@ interface SelectParams { source: string; target: string; } + +interface Connection { + setDetachable(detachable: boolean): void; + setParameter(name: string, value: T): void; + endpoints: Endpoint[]; +} + +interface Endpoint { +} \ No newline at end of file