src/basis/ui.js
function extendBinding(binding, extension){
    /** @cut */ var info = basis.dev.getInfo(extension, 'map');

    binding.bindingId = bindingSeed++;

    for (var key in extension)
    {
      var def = null;
      var value = extension[key];

      // NOTE: check for Node, because first extendBinding invoke before Node class declared
      if ((Node && value instanceof Node) || basis.resource.isResource(value))
      {
        def = {
          events: 'satelliteChanged',
          getter: (function(key, satellite){
            var resource = typeof satellite == 'function' ? satellite : null;
            var init = function(node){
              init = false;

              if (resource)
              {
                satellite = resource();
                if (satellite instanceof Node == false)
                  return;
                resource = null;
              }

              node.setSatellite(key, satellite);

              /** @cut */ if (node.satellite[key] !== satellite)
              /** @cut */   basis.dev.warn('basis.ui.binding: implicit satellite `' + key + '` attach to owner failed');
            };
            return function(node){
              if (init)
                init(node);

              return resource || (node.satellite[key] ? node.satellite[key].element : null);
            };
          })(key, value)
        };
      }
      else
      {
        if (value)
        {
          if (typeof value == 'string')
            value = BINDING_PRESET.process(key, value);
          else
            // if value has bindingBridge means that it can update itself
            if (value.bindingBridge)
              value = basis.fn.$const(value);

          if (typeof value != 'object')
          {
            def = {
              getter: typeof value == 'function' ? value : basis.getter(value)
            };
          }
          else
            if (Array.isArray(value))
            {
              def = {
                events: value[0],
                getter: basis.getter(value[1])
              };
            }
            else
            {
              def = {
                events: value.events,
                getter: basis.getter(value.getter)
              };
            }
        }
      }

      /** @cut */ if (def && info && info.hasOwnProperty(key))
      /** @cut */   def.loc = info[key];

      binding[key] = def;
    }
  }
function extendBinding(binding, extension){
    /** @cut */ var info = basis.dev.getInfo(extension, 'map');

    binding.bindingId = bindingSeed++;

    for (var key in extension)
    {
      var def = null;
      var value = extension[key];

      // NOTE: check for Node, because first extendBinding invoke before Node class declared
      if ((Node && value instanceof Node) || basis.resource.isResource(value))
      {
        def = {
          events: 'satelliteChanged',
          getter: (function(key, satellite){
            var resource = typeof satellite == 'function' ? satellite : null;
            var init = function(node){
              init = false;

              if (resource)
              {
                satellite = resource();
                if (satellite instanceof Node == false)
                  return;
                resource = null;
              }

              node.setSatellite(key, satellite);

              /** @cut */ if (node.satellite[key] !== satellite)
              /** @cut */   basis.dev.warn('basis.ui.binding: implicit satellite `' + key + '` attach to owner failed');
            };
            return function(node){
              if (init)
                init(node);

              return resource || (node.satellite[key] ? node.satellite[key].element : null);
            };
          })(key, value)
        };
      }
      else
      {
        if (value)
        {
          if (typeof value == 'string')
            value = BINDING_PRESET.process(key, value);
          else
            // if value has bindingBridge means that it can update itself
            if (value.bindingBridge)
              value = basis.fn.$const(value);

          if (typeof value != 'object')
          {
            def = {
              getter: typeof value == 'function' ? value : basis.getter(value)
            };
          }
          else
            if (Array.isArray(value))
            {
              def = {
                events: value[0],
                getter: basis.getter(value[1])
              };
            }
            else
            {
              def = {
                events: value.events,
                getter: basis.getter(value.getter)
              };
            }
        }
      }

      /** @cut */ if (def && info && info.hasOwnProperty(key))
      /** @cut */   def.loc = info[key];

      binding[key] = def;
    }
  }
function extendBinding ( binding , extension ) { /** @cut */ var info = basis . dev . getInfo ( extension , 'map' ) ; binding . bindingId = bindingSeed ++ ; for ( var key in extension ) { var def = null ; var value = extension [ key ] ; // NOTE: check for Node, because first extendBinding invoke before Node class declared if ( ( Node && value instanceof Node ) || basis . resource . isResource ( value ) ) { def = { events : 'satelliteChanged' , getter : ( function ( key , satellite ) { var resource = typeof satellite == 'function' ? satellite : null ; var init = function ( node ) { init = false ; if ( resource ) { satellite = resource ( ) ; if ( satellite instanceof Node == false ) return ; resource = null ; } node . setSatellite ( key , satellite ) ; /** @cut */ if ( node . satellite [ key ] !== satellite ) /** @cut */ basis . dev . warn ( 'basis.ui.binding: implicit satellite `' + key + '` attach to owner failed' ) ; } ; return function ( node ) { if ( init ) init ( node ) ; return resource || ( node . satellite [ key ] ? node . satellite [ key ] . element : null ) ; } ; } ) ( key , value ) } ; } else { if ( value ) { if ( typeof value == 'string' ) value = BINDING_PRESET . process ( key , value ) ; else // if value has bindingBridge means that it can update itself if ( value . bindingBridge ) value = basis . fn . $const ( value ) ; if ( typeof value != 'object' ) { def = { getter : typeof value == 'function' ? value : basis . getter ( value ) } ; } else if ( Array . isArray ( value ) ) { def = { events : value [ 0 ] , getter : basis . getter ( value [ 1 ] ) } ; } else { def = { events : value . events , getter : basis . getter ( value . getter ) } ; } } } /** @cut */ if ( def && info && info . hasOwnProperty ( key ) ) /** @cut */ def . loc = info [ key ] ; binding [ key ] = def ; } }
Function that extends list of binding by extension.
@param {object} binding
@param {object} extension
Function that extends list of binding by extension .