A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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;