A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

46 行
1005B

  1. import GlobalEvents from "/app/js/common/EventCaller.js";
  2. function handle_emitter(event){
  3. if (this.hasAttribute("emit")){
  4. var args = [this.getAttribute("emit"), this];
  5. if (this.hasAttribute("emit-args")){
  6. try {
  7. var j = JSON.parse(this.getAttribute("emit-args"));
  8. if (j instanceof Array){
  9. args.concat(j);
  10. } else {
  11. args.push(j);
  12. }
  13. } catch (e) {
  14. console.log("Failed to emit '" + args[0] +"': " + e.toString());
  15. //console.log("Failed to emit '" + args[0] + "'. Attribute 'emit-args' contains malformed JSON.");
  16. }
  17. }
  18. GlobalEvents.emit.apply(GlobalEvents, args);
  19. }
  20. }
  21. export default {
  22. initialize: function(){
  23. var elist = document.querySelectorAll("[emit]");
  24. elist.forEach(function(el){
  25. el.addEventListener("click", handle_emitter);
  26. });
  27. },
  28. initialize_element: function(el){
  29. if (el.hasAttribute("emit")){
  30. el.addEventListener("click", handle_emitter);
  31. }
  32. }
  33. }