Skip to content

Instantly share code, notes, and snippets.

@jason-s13r
Last active March 27, 2019 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jason-s13r/e5f8dc43c748032917b25af478ef94df to your computer and use it in GitHub Desktop.
Save jason-s13r/e5f8dc43c748032917b25af478ef94df to your computer and use it in GitHub Desktop.
Typescript type definitions for [vue-signature-pad](https://www.npmjs.com/package/vue-signature-pad), probably not entirely correct.
declare module 'vue-signature-pad' {
import signature_pad, * as SignaturePad from 'signature_pad';
import Vue from 'vue';
export interface IOptions extends SignaturePad.IOptions {}
export interface IPointGroup extends SignaturePad.IPointGroup {}
export interface Status {
isEmpty: boolean;
data?: any;
}
export default class VueSignaturePad extends Vue {
// props
width: string;
height: string;
customStyle: any;
saveType: string;
options: IOptions;
images: any[];
// computer
propsImagesAndCustomImages: any[];
// methods
resizeCanvas(): void;
saveSignature(): Status;
undoSignature(): void;
mergeImageAndSignature(customSignature: any): Promise<any>; // TODO: constrain to correct return type.
addImages(images: any[]): Promise<any>; // TODO: constrain to correct param type and return type.
fromDataURL(data: string): void;
lockSignaturePad(): void;
openSignaturePad(): void;
isEmpty(): boolean;
getPropImagesAndCacheImages(): any[];
clearCacheImages(): 'this.cacheImages';
clearSignature(): void;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment