From 9c53f004ac319e5fd1a5f52ba21dedec1961fc2c Mon Sep 17 00:00:00 2001 From: Chris Willis-Ford Date: Wed, 12 Aug 2015 12:32:19 +0200 Subject: [PATCH] Sample extension for use with Scratch and ScratchX For information on writing Scratch extensions, see: https://github.com/LLK/scratchx/wiki#writing-extensions-for-scratchx --- sampleExtension.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sampleExtension.js diff --git a/sampleExtension.js b/sampleExtension.js new file mode 100644 index 0000000..644ae42 --- /dev/null +++ b/sampleExtension.js @@ -0,0 +1,29 @@ +(function(ext) { + // Cleanup function when the extension is unloaded + ext._shutdown = function() { + }; + + // Status reporting code + // Return any message to be displayed as a tooltip. + // Status values: 0 = error (red), 1 = warning (yellow), 2 = ready (green) + ext._getStatus = function() { + return {status: 2, msg: 'Ready'}; + }; + + // For information on writing Scratch extensions, see the ScratchX wiki: + // https://github.com/LLK/scratchx/wiki#writing-extensions-for-scratchx + ext.doSomething = function() { + // code to do something goes here + }; + + // Block and block menu descriptions + var descriptor = { + blocks: [ + [' ', 'do something', 'doSomething'] + ], + url: 'http://' // Link to extension documentation, homepage, etc. + }; + + // Register the extension + ScratchExtensions.register('Sample extension', descriptor, ext); +})({});