index.js
function (body1, body2, springLength, springWeight, springCoefficient) {
      if (!body1 || !body2) {
        throw new Error('Cannot add null spring to force simulator');
      }

      if (typeof springLength !== 'number') {
        springLength = -1; // assume global configuration
      }

      var spring = new Spring(body1, body2, springLength, springCoefficient >= 0 ? springCoefficient : -1, springWeight);
      springs.push(spring);

      // TODO: could mark simulator as dirty.
      return spring;
    }
function (body1, body2, springLength, springWeight, springCoefficient) {
      if (!body1 || !body2) {
        throw new Error('Cannot add null spring to force simulator');
      }

      if (typeof springLength !== 'number') {
        springLength = -1; // assume global configuration
      }

      var spring = new Spring(body1, body2, springLength, springCoefficient >= 0 ? springCoefficient : -1, springWeight);
      springs.push(spring);

      // TODO: could mark simulator as dirty.
      return spring;
    }
function ( body1 , body2 , springLength , springWeight , springCoefficient ) { if ( ! body1 || ! body2 ) { throw new Error ( 'Cannot add null spring to force simulator' ) ; } if ( typeof springLength !== 'number' ) { springLength = - 1 ; // assume global configuration } var spring = new Spring ( body1 , body2 , springLength , springCoefficient >= 0 ? springCoefficient : - 1 , springWeight ) ; springs . push ( spring ) ; // TODO: could mark simulator as dirty. return spring ; }
Adds a spring to this simulation.

@returns {Object} - a handle for a spring. If you want to later remove
spring pass it to removeSpring() method.
Adds a spring to this simulation .