mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Create types: @types/js-captcha (#35686)
This commit is contained in:
parent
8821e40a2e
commit
c3a16ffdf2
32
types/js-captcha/dist/js/jCaptcha.d.ts
vendored
Normal file
32
types/js-captcha/dist/js/jCaptcha.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
declare namespace jCaptcha {
|
||||
/**
|
||||
* Options for the base jCaptcha class. Derived from https://github.com/robiveli/js-captcha#options
|
||||
*/
|
||||
interface Options {
|
||||
el?: string;
|
||||
|
||||
requiredValue?: string;
|
||||
|
||||
resetOnError?: boolean;
|
||||
focusOnError?: boolean;
|
||||
clearOnSubmit?: boolean;
|
||||
|
||||
canvasWidth?: number;
|
||||
canvasHeight?: number;
|
||||
canvasFontSize?: string;
|
||||
canvasFontFamily?: string;
|
||||
canvasFillStyle?: string;
|
||||
|
||||
callback?: (response: "success" | "error", input: NodeListOf<Element>) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare class jCaptcha {
|
||||
constructor(options?: jCaptcha.Options);
|
||||
|
||||
validate(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
export = jCaptcha;
|
||||
export as namespace jCaptcha;
|
||||
7
types/js-captcha/index.d.ts
vendored
Normal file
7
types/js-captcha/index.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Type definitions for js-captcha 1.1
|
||||
// Project: https://github.com/robiveli/js-captcha
|
||||
// Definitions by: PikachuEXE <https://github.com/pikachuexe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as jCaptcha from "./dist/js/jCaptcha";
|
||||
31
types/js-captcha/js-captcha-tests.ts
Normal file
31
types/js-captcha/js-captcha-tests.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import jCaptcha from "js-captcha/dist/js/jCaptcha";
|
||||
|
||||
const myCaptcha1 = new jCaptcha({
|
||||
el: "jCaptcha1",
|
||||
|
||||
requiredValue: "*",
|
||||
|
||||
resetOnError: true,
|
||||
focusOnError: true,
|
||||
clearOnSubmit: true,
|
||||
|
||||
canvasWidth: 50,
|
||||
canvasHeight: 15,
|
||||
canvasFontSize: "15px",
|
||||
canvasFontFamily: "Arial",
|
||||
canvasFillStyle: "#ddd",
|
||||
|
||||
callback: (response: "success" | "error", input: NodeListOf<Element>) => {
|
||||
if (response === "success") {
|
||||
// Do something
|
||||
}
|
||||
|
||||
if (response === "error") {
|
||||
// Do something
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const myCaptcha2 = new jCaptcha({});
|
||||
|
||||
const myCaptcha3 = new jCaptcha();
|
||||
26
types/js-captcha/tsconfig.json
Normal file
26
types/js-captcha/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dist/js/jCaptcha.d.ts",
|
||||
"js-captcha-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/js-captcha/tslint.json
Normal file
3
types/js-captcha/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user