A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
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.

36 lines
997B

  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;