JavaScript implementation of 'spark'.