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个字符

44 行
1.1KB

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