All the informations on the API calls can be found on the official Leapmotion website.
To access the leapmotion on a webpage, first import the libs:
<script src="leap-0.6.4.js"></script>
<script src="leap-plugins-0.1.12.js"></script>
Then we create a controller
var controller = new Leap.Controller();
and finally, create and execute the loop:
controller.on('frame', function(frame){
// instructions of your loop
});
controller.connect();