Package Exports
- jitscratch
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jitscratch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JITScratch is a framework for compiling procedure-based Scratch projects to node.js-compatible JavaScript.
It exposes a simple API simple install via npm:
$ npm install jitscratch
Once installed, it exposes a simple, CommonJS interface.
Hello, World
var JITScratch = require("JITScratch");
var helloWorld = new JITScratch();
helloWorld.fetchScratchProject(10297480, function() {
console.log(helloWorld.generateSourceCode());
});
API
require("JITScratch"): returns a JITScratch class
JITScratch class:
fetchScratchProject(id, callback)
Fetches a Scratch project off the Scratch website where id is the project ID. callback has no parameters, and calls rawProject with the fetched JSON-representation of the project.
rawProject(json)
Loads the JSON project representation directly into JITScratch
generateSourceCode()
Returns JavaScript source code of the JSON project.
getProcDefs()
Returns an array of block specs used by the procedures, in the order of the procedure function calls in the source code.