src/basis/data/resolve.js
function createResolveFunction(Class){
  return function resolve(context, fn, source, property, factoryContext){
    var oldAdapter = context[property] || null;
    var newAdapter = null;

    if (fn !== resolveAdapterProxy && typeof source == 'function')
      source = source.call(factoryContext || context, factoryContext || context);

    if (source && source.bindingBridge)
    {
      if (!oldAdapter || oldAdapter.source !== source)
        newAdapter = new BBResolveAdapter(context, fn, source, DEFAULT_CHANGE_ADAPTER_HANDLER);
      else
        newAdapter = oldAdapter;

      source = resolve(newAdapter, resolveAdapterProxy, source.bindingBridge.get(source), 'next');
    }

    if (source instanceof Class == false)
      source = null;

    if (property && oldAdapter !== newAdapter)
    {
      var cursor = oldAdapter;

      // drop old adapter chain
      while (cursor)
      {
        var adapter = cursor;
        adapter.detach();
        cursor = adapter.next;
        adapter.next = null;
      }

      if (newAdapter)
        newAdapter.attach(DEFAULT_DESTROY_ADAPTER_HANDLER);

      context[property] = newAdapter;
    }

    return source;
  };
}
function createResolveFunction(Class){
  return function resolve(context, fn, source, property, factoryContext){
    var oldAdapter = context[property] || null;
    var newAdapter = null;

    if (fn !== resolveAdapterProxy && typeof source == 'function')
      source = source.call(factoryContext || context, factoryContext || context);

    if (source && source.bindingBridge)
    {
      if (!oldAdapter || oldAdapter.source !== source)
        newAdapter = new BBResolveAdapter(context, fn, source, DEFAULT_CHANGE_ADAPTER_HANDLER);
      else
        newAdapter = oldAdapter;

      source = resolve(newAdapter, resolveAdapterProxy, source.bindingBridge.get(source), 'next');
    }

    if (source instanceof Class == false)
      source = null;

    if (property && oldAdapter !== newAdapter)
    {
      var cursor = oldAdapter;

      // drop old adapter chain
      while (cursor)
      {
        var adapter = cursor;
        adapter.detach();
        cursor = adapter.next;
        adapter.next = null;
      }

      if (newAdapter)
        newAdapter.attach(DEFAULT_DESTROY_ADAPTER_HANDLER);

      context[property] = newAdapter;
    }

    return source;
  };
}
function createResolveFunction ( Class ) { return function resolve ( context , fn , source , property , factoryContext ) { var oldAdapter = context [ property ] || null ; var newAdapter = null ; if ( fn !== resolveAdapterProxy && typeof source == 'function' ) source = source . call ( factoryContext || context , factoryContext || context ) ; if ( source && source . bindingBridge ) { if ( ! oldAdapter || oldAdapter . source !== source ) newAdapter = new BBResolveAdapter ( context , fn , source , DEFAULT_CHANGE_ADAPTER_HANDLER ) ; else newAdapter = oldAdapter ; source = resolve ( newAdapter , resolveAdapterProxy , source . bindingBridge . get ( source ) , 'next' ) ; } if ( source instanceof Class == false ) source = null ; if ( property && oldAdapter !== newAdapter ) { var cursor = oldAdapter ; // drop old adapter chain while ( cursor ) { var adapter = cursor ; adapter . detach ( ) ; cursor = adapter . next ; adapter . next = null ; } if ( newAdapter ) newAdapter . attach ( DEFAULT_DESTROY_ADAPTER_HANDLER ) ; context [ property ] = newAdapter ; } return source ; } ; }
Class instance resolve function factory
Class instance resolve function factory