smsc/lib/GG-SmsBatch.js
function SmsBatch (smsc, callback, smsarray) {
    var idx=0;

    // when message is processed move to next one otherwise call user applicationCB
    function InternalCB (data) {

        // [good or bad] let's notify user application
        if (data.status != 0) callback (data);

        // it's time to move to next message
        if (data.status <= 0) {
            if (++idx < smsarray.length) {
                new SmsRequest (smsc, InternalCB, smsarray [idx]);
            } else {
                callback ({status: 0});
            }
        }
    }

    // let's start by sending 1st SMS of the array
    new SmsRequest(smsc, InternalCB, smsarray [idx]);
}
function SmsBatch (smsc, callback, smsarray) {
    var idx=0;

    // when message is processed move to next one otherwise call user applicationCB
    function InternalCB (data) {

        // [good or bad] let's notify user application
        if (data.status != 0) callback (data);

        // it's time to move to next message
        if (data.status <= 0) {
            if (++idx < smsarray.length) {
                new SmsRequest (smsc, InternalCB, smsarray [idx]);
            } else {
                callback ({status: 0});
            }
        }
    }

    // let's start by sending 1st SMS of the array
    new SmsRequest(smsc, InternalCB, smsarray [idx]);
}
function SmsBatch ( smsc , callback , smsarray ) { var idx = 0 ; // when message is processed move to next one otherwise call user applicationCB function InternalCB ( data ) { // [good or bad] let's notify user application if ( data . status != 0 ) callback ( data ) ; // it's time to move to next message if ( data . status <= 0 ) { if ( ++ idx < smsarray . length ) { new SmsRequest ( smsc , InternalCB , smsarray [ idx ] ) ; } else { callback ( { status : 0 } ) ; } } } // let's start by sending 1st SMS of the array new SmsRequest ( smsc , InternalCB , smsarray [ idx ] ) ; }
this method send a batch of SMS and call user CB with status=0 when finish
this method send a batch of SMS and call user CB with status = 0 when finish