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.

36 lines
1000B

  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 el 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(el) === "object") &&
  13. (el.nodeType === 1) &&
  14. (typeof(el.style) === "object") &&
  15. (typeof(el.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;