packages/wxa-core/src/utils/decorators.js
function Lock(target, name, descriptor) {
    let fn = descriptor.value;
    let $$LockIsDoing = false;

    let reset = ()=>$$LockIsDoing=false;
    descriptor.value = function(...args) {
        if ($$LockIsDoing) return;
        $$LockIsDoing = true;

        let ret = fn.apply(this, args);

        if (ret && ret.then) {
            // is promise
            return ret.then((succ)=>{
                reset();
                return Promise.resolve(succ);
            }, (fail)=>{
                reset();
                return Promise.reject(fail);
            });
        } else {
            reset();
            return ret;
        }
    };

    return descriptor;
}
function Lock(target, name, descriptor) {
    let fn = descriptor.value;
    let $$LockIsDoing = false;

    let reset = ()=>$$LockIsDoing=false;
    descriptor.value = function(...args) {
        if ($$LockIsDoing) return;
        $$LockIsDoing = true;

        let ret = fn.apply(this, args);

        if (ret && ret.then) {
            // is promise
            return ret.then((succ)=>{
                reset();
                return Promise.resolve(succ);
            }, (fail)=>{
                reset();
                return Promise.reject(fail);
            });
        } else {
            reset();
            return ret;
        }
    };

    return descriptor;
}
function Lock ( target , name , descriptor ) { let fn = descriptor . value ; let $$LockIsDoing = false ; let reset = ( ) => $$LockIsDoing = false ; descriptor . value = function ( ... args ) { if ( $$LockIsDoing ) return ; $$LockIsDoing = true ; let ret = fn . apply ( this , args ) ; if ( ret && ret . then ) { // is promise return ret . then ( ( succ ) => { reset ( ) ; return Promise . resolve ( succ ) ; } , ( fail ) => { reset ( ) ; return Promise . reject ( fail ) ; } ) ; } else { reset ( ) ; return ret ; } } ; return descriptor ; }
Lock function util fn finish process

@param {any} target
@param {any} name
@param {any} descriptor

@return {any}
Lock function util fn finish process