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.
 
 
 

34 lines
646 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(l => l.id === q.id);
  19. this.list.push(q);
  20. }, this);
  21. }
  22. if (blueprint.removeList) {
  23. blueprint.removeList.forEach(function (q) {
  24. events.emit('onRemoveEvent', q.id);
  25. this.list.spliceWhere(l => l.id === q.id);
  26. }, this);
  27. }
  28. }
  29. };
  30. });