为一个或多个事件附加一个事件处理函数到指定的元素。
eventer.on(elm, events, selector, data, callback, one)
Example: 处理函数在每个元素上每种事件类型执行数累计 +1。
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <div class="count">0</div> <button class="target">Counter</button> <script> require(["skylark/query", "skylark/eventer"], function($, eventer) { var count = $(".count"), value = count.text(); eventer.on($(".target")[0], "click mouseenter", function() { count.html(++value); }); }); </script> </body> </html>