256
Fl
FlyingFunctions / files
FlyingFunctions / test / events.html
1.0 KB
1<!doctype html> 2<html lang="en"> 3<head> 4 <title>Flying Functions Events test</title> 5</head> 6<body> 7 8 <script src="../lib/flying-functions.js"></script> 9 <script> 10 console.log(FlyingFunctions); 11 console.log(FlyingFunctions.prototype); 12 13 var ff = new FlyingFunctions(); 14 15 console.log(ff); 16 17 ff.on('test', function () { 18 console.log('Inside handler'); 19 console.log(arguments); 20 console.log(this === ff); 21 }); 22 23 ff.once('onetime', function () { 24 console.log(arguments); 25 }); 26 27 ff.on('async', function () { 28 console.log(arguments); 29 console.log('is flying funcitions obj: ', this instanceof FlyingFunctions); 30 }); 31 32 ff.trigger('test', { one: 1 }, 2, 'three'); 33 ff.trigger('onetime', 'calling once!!'); 34 35 setTimeout(function () { 36 ff.trigger('async', 'look mum, im asynchronous'); 37 ff.trigger('onetime', 'calling twice... oh no...'); 38 }, 5000); 39 40 </script> 41 42</body> 43</html>