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.
 
 
 

38 lines
710 B

  1. define([
  2. 'js/system/events'
  3. ], function (
  4. events
  5. ) {
  6. return {
  7. type: 'events',
  8. list: [],
  9. init: function () {
  10. this.list.forEach(function (q) {
  11. events.emit('onObtainEvent', q);
  12. });
  13. },
  14. extend: function (blueprint) {
  15. if (blueprint.updateList) {
  16. blueprint.updateList.forEach(function (q) {
  17. events.emit('onObtainEvent', q);
  18. this.list.spliceWhere(function (l) {
  19. return (l.id == q.id);
  20. });
  21. this.list.push(q);
  22. }, this);
  23. }
  24. if (blueprint.removeList) {
  25. blueprint.removeList.forEach(function (q) {
  26. events.emit('onRemoveEvent', q.id);
  27. this.list.spliceWhere(function (l) {
  28. return (l.id == q.id);
  29. });
  30. }, this);
  31. }
  32. }
  33. };
  34. });