修改过页面
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
369 B

1 year ago
  1. var MyEvent = function(type="") {
  2. this.type = type;
  3. this.listeners = [];
  4. };
  5. MyEvent.prototype.addListener = function(listener) {
  6. this.listeners.push(listener);
  7. }
  8. MyEvent.prototype.dispatch = function() {
  9. for (var listener of this.listeners) {
  10. var ret = listener.apply(null, arguments);
  11. if (!ret) {
  12. return;
  13. }
  14. }
  15. }