1.html 630 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width" />
  6. <title>1</title>
  7. </head>
  8. <body>
  9. <h1>1</h1>
  10. <script src="../ev-emitter.js"></script>
  11. <script>
  12. var ee = new EvEmitter;
  13. var hey = function( a, b, c ) { console.log('hey', a, b, c ) };
  14. var ho = function( a, b, c ) { console.log('ho', a, b, c ) };
  15. var letsGo = function( a, b, c ) { console.log('lets go', a, b, c ) };
  16. ee.on( 'foo', hey );
  17. ee.once( 'foo', ho );
  18. ee.on( 'foo', letsGo );
  19. ee.emitEvent( 'foo', [ 1, 2, 3 ] );
  20. ee.off('foo', hey );
  21. ee.emitEvent( 'foo', [ 4, 5, 6 ] );
  22. </script>
  23. </body>
  24. </html>