mirror of
https://github.com/scratchfoundation/scratchx-example.git
synced 2024-11-21 10:18:13 -05:00
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
This commit is contained in:
commit
9c53f004ac
1 changed files with 29 additions and 0 deletions
29
sampleExtension.js
Normal file
29
sampleExtension.js
Normal file
|
@ -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);
|
||||
})({});
|
Loading…
Reference in a new issue