yas.js 771 Bytes
import yoho from 'yoho';

export default () => {
    return {
        REC_ID: '',
        generateREC_ID() {
            return (new Date().getTime() + '_H5_YOHOBLK_' + Math.floor(Math.random() * 1000000 + 1000000) +
            '_' + Math.floor(Math.random() * 1000000 + 1000000));
        },
        event(op, param) {
            if (window._yas && window._yas.sendAppLogs) {
                window._yas.sendAppLogs({
                    appop: op,
                    param: JSON.stringify(Object.assign(param, {
                        REC_ID: this.REC_ID
                    }))
                }, true);
            }
        },
        eventData(op, param) {
            this.REC_ID = this.generateREC_ID();
            this.event(op, param);
        }
    };
};