lib/dhtmlxVault/codebase/vault.js
// cb, ec, cn : successCallback, failureCallback, notThennableCallback
cb, ec, cn : successCallback, failureCallback, notThennableCallback
cb ec cn : successCallback failureCallback notThennableCallback
function thennable (ref, cb, ec, cn) {
      if (state == 2) {
        return cn()
      }
      if ((typeof val == 'object' || typeof val == 'function') && typeof ref == 'function') {
        try {
          var cnt = 0
          ref.call(val, function (v) {
            if (cnt++) return
            val = v
            cb()
          }, function (v) {
            if (cnt++) return
            val = v
            ec()
          })
        } catch (e) {
          val = e
          ec()
        }
      } else {
        cn()
      }
    }
function thennable ( ref , cb , ec , cn ) { if ( state == 2 ) { return cn ( ) } if ( ( typeof val == 'object' || typeof val == 'function' ) && typeof ref == 'function' ) { try { var cnt = 0 ref . call ( val , function ( v ) { if ( cnt ++ ) return val = v cb ( ) } , function ( v ) { if ( cnt ++ ) return val = v ec ( ) } ) } catch ( e ) { val = e ec ( ) } } else { cn ( ) } }
cb, ec, cn : successCallback, failureCallback, notThennableCallback
cb ec cn : successCallback failureCallback notThennableCallback
// Promises can be rejected with other promises, which should pass through // cnt protects against abuse calls from spec checker