mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add vex typings
This commit is contained in:
parent
0c2ee8583c
commit
7dd2af62af
45
vex-js/vex-js.d.ts
vendored
Normal file
45
vex-js/vex-js.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
// Type definitions for Vex v2.3.2
|
||||
// Project: https://github.com/HubSpot/vex
|
||||
// Definitions by: Greg Cohan <https://github.com/gdcohan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module vex {
|
||||
|
||||
interface ICSSAttributes {
|
||||
[property: string]: string | number;
|
||||
}
|
||||
|
||||
interface IVexOptions {
|
||||
afterClose?: (() => void);
|
||||
afterOpen?: ((vexContent: JQuery) => void);
|
||||
content?: string;
|
||||
showCloseButton?: boolean;
|
||||
escapeButtonCloses?: boolean;
|
||||
overlayClosesOnClick?: boolean;
|
||||
appendLocation?: HTMLElement | JQuery | string;
|
||||
className?: string;
|
||||
css?: ICSSAttributes;
|
||||
overlayClassName?: string;
|
||||
overlayCSS?: ICSSAttributes;
|
||||
contentClassName?: string;
|
||||
contentCSS?: ICSSAttributes;
|
||||
closeClassName?: string;
|
||||
closeCSS?: ICSSAttributes;
|
||||
}
|
||||
|
||||
interface Vex {
|
||||
open(options: IVexOptions): JQuery;
|
||||
close(id?: number): boolean;
|
||||
closeAll(): boolean;
|
||||
closeByID(id: number): boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "vex" {
|
||||
export = vex;
|
||||
}
|
||||
|
||||
declare var vex: vex.Vex;
|
||||
26
vex-js/vex-tests.ts
Normal file
26
vex-js/vex-tests.ts
Normal file
@ -0,0 +1,26 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="vex-js.d.ts" />
|
||||
|
||||
var vexContent = vex.open({
|
||||
afterClose: (() => null),
|
||||
afterOpen: ((vexContent: JQuery) => null),
|
||||
content: "<div><p>Modal</p></div>",
|
||||
showCloseButton: false,
|
||||
escapeButtonCloses: true,
|
||||
overlayClosesOnClick: false,
|
||||
appendLocation: "body",
|
||||
className: "vex-dialog",
|
||||
css: {background: "blue"},
|
||||
overlayClassName: "vex-overlay",
|
||||
overlayCSS: {border: 0},
|
||||
contentClassName: "vex-content",
|
||||
contentCSS: {margin: "0 auto"},
|
||||
closeClassName: "vex-close",
|
||||
closeCSS: {margin: 0}
|
||||
});
|
||||
|
||||
var id = vexContent.data().vex.id;
|
||||
|
||||
vex.close(id);
|
||||
vex.closeByID(id);
|
||||
vex.closeAll();
|
||||
Loading…
Reference in New Issue
Block a user