This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createOffloadedFunction(...code) {//arg 0 is func and all aditional args are support and loaded in after. | |
window.URL = window.URL || window.webkitURL; | |
let func = code.shift(); | |
var response = code.join("\n\n") + `\n\nconst func = ${func.toString()}\n\nself.onmessage=function(pack){self.postMessage({id:pack.data.id,data:func(...pack.data.data)})}\n\n`; | |
var blob; | |
try { | |
blob = new Blob([response], { type: 'application/javascript' }); | |
} catch (e) { | |
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import Tilemap from "./Tilemap.jsx"; | |
class ReadyEvent extends Event { | |
constructor(tilemap) { | |
super("ReadyEvent", { | |
Tiledap: tilemap, | |
map: tilemap.state.data | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInt(number){ | |
return number==(number|0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//tiled render code | |
//by glEnd2 | |
/* | |
to use create a new Tilemap object with the path to your .json file exported from tiled. | |
will do the rest from there. | |
to get renderable canvas use Tilemap.getImage(); | |
rendering is done at creation so that there is less overhead later on. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = document.querySelector("#id_miles"); | |
let b=a.parentElement; | |
b.appendChild(data); | |
b.removeChild(a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
canvas{ | |
border:0px solid black; | |
} |