2.1.7 • Published 6 months ago

@types/netease-captcha v2.1.7

Weekly downloads
14,772
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/netease-captcha

Summary

This package contains type definitions for netease-captcha (https://cstaticdun.126.net/load.min.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/netease-captcha.

index.d.ts

// Type definitions for non-npm package netease-captcha 2.1
// Project: https://cstaticdun.126.net/load.min.js
// Definitions by: Minjie Shen <https://github.com/norubidium>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

interface Window {
    initNECaptcha?: NeteaseCaptcha.InitFunction | undefined;
}

declare namespace NeteaseCaptcha {
    type InitFunction = (config: Config, onLoad?: onLoad, onError?: onError) => void;

    interface Config {
        /**
         * Verification code id
         */
        captchaId: string;

        /**
         * Selector string or HTMLElement to render widget into
         */
        element: string | HTMLElement;

        /**
         * Defaults to 'float' on desktop, and 'popup' on mobile. 'bind' is for invisible captcha
         */
        mode?: 'float' | 'embed' | 'popup' | 'bind' | undefined;

        /**
         * Defaults to page protocol
         */
        protocol?: 'http' | 'https' | undefined;

        /**
         * Defaults to 'auto'
         */
        width?: number | string | undefined;

        /**
         * Defaults to 'zh-CN'
         */
        lang?: 'zh-CN' | 'en' | undefined;

        onReady?(instance: Instance): void;

        onVerify?(error: any, data: Data): void;
    }

    interface Instance {
        /**
         * Refresh the instance to get new verification information
         */
        refresh(): void;

        /**
         * Destroy the current instance
         */
        destroy(): void;

        /**
         * Available when the mode is set to 'popup' - opens the popup to accept verification
         */
        popUp?(): void;
        /**
         * Available when the mode is set to 'bind' - verify token manually
         */
        verify?(): void;
    }

    interface Data {
        validate: string;
    }

    type onLoad = (instance: Instance) => void;

    type onError = (error: any) => void;
}

Additional Details

  • Last updated: Tue, 27 Jul 2021 18:31:40 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Minjie Shen.

2.1.6

7 months ago

2.1.5

8 months ago

2.1.7

6 months ago

2.1.4

2 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

5 years ago

2.1.0

5 years ago