jessjs

Binding events to support mobile terminals and PC ends

Usage no npm install needed!

<script type="module">
  import jessjs from 'https://cdn.skypack.dev/jessjs';
</script>

README

jess

浏览器方式使用

  <h3 id="dv1">点我吧!</h3>
  <h3 id="dv2">你还不点我!</h3>
  <h3 id="dv3">你赶紧点我!</h3>

  <script type="text/javascript" src="dist/jess.js"></script>
  <script type="text/javascript">
    console.log(Jess);

    Jess.on('click', dv1, function (that, event) {
      console.log('返回结果:');
      console.log('that:', that);
      console.log('event:', event);
    });

    // 选择器支持数组
    Jess.on('click', [dv2, dv3], function (that, event) {
      console.log('返回结果:');
      console.log('that:', that);
      console.log('event:', event);
    });
  </script>

require方式使用

    const Jess = require('jessjs');

  Jess.on('click', selector, (that, event) => {
      console.log('返回结果:');
      console.log('that:', that);
      console.log('event:', event);
  });