captcha.js 557 Bytes
import $ from 'jquery';

const url = 'https://ssl.captcha.qq.com/TCaptcha.js';

function _initScript() {
    return $.getScript(url);
}

const store = {
    appId: ''
};

export default {
    init() {
        let $tencentCaptcha = $('.yoho-tencentCaptcha');
        store.appId = $tencentCaptcha.data('appid');

        if (store.appId) {
            return _initScript();
        }

        return $.Deferred().resolve();
    },

    getInstance(cb) {
        // eslint-disable-next-line
        return new TencentCaptcha(store.appId+'', cb, {});
    }
};