A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Utils.js 997B

1234567891011121314151617181920212223242526272829303132333435
  1. const utils = {
  2. isElement:function(el){
  3. // Code based on...
  4. // https://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
  5. try {
  6. // Using W3 DOM2 (works for FF, Opera and Chrome)
  7. return obj instanceof HTMLElement;
  8. } catch(e) {
  9. // Browsers not supporting W3 DOM2 don't have HTMLElement and
  10. // an exception is thrown and we end up here. Testing some
  11. // properties that all elements have (works on IE7)
  12. return (typeof obj==="object") &&
  13. (obj.nodeType===1) &&
  14. (typeof obj.style === "object") &&
  15. (typeof obj.ownerDocument ==="object");
  16. }
  17. },
  18. debounce:function(func, delay){
  19. var timeout = null;
  20. return function(){
  21. var context = this;
  22. var args = arguments;
  23. clearTimeout(timeout);
  24. timeout = setTimeout(function(){
  25. func.apply(context, args);
  26. }, delay);
  27. };
  28. }
  29. };
  30. Object.freeze(utils);
  31. export default utils;