mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Lint for eslint-config-scratch@3
This commit is contained in:
parent
a6568c4bf2
commit
727fcc7875
22 changed files with 65 additions and 65 deletions
|
@ -11,7 +11,7 @@ var Scratch3ControlBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3ControlBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -10,7 +10,7 @@ var Scratch3DataBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3DataBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -10,7 +10,7 @@ var Scratch3EventBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3EventBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -10,7 +10,7 @@ var Scratch3LooksBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3LooksBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -12,7 +12,7 @@ var Scratch3MotionBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3MotionBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -11,7 +11,7 @@ var Scratch3OperatorsBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3OperatorsBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -163,7 +163,7 @@ Scratch3PenBlocks.prototype._wrapHueOrShade = function (value) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3PenBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -8,7 +8,7 @@ var Scratch3ProcedureBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3ProcedureBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -10,7 +10,7 @@ var Scratch3SensingBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3SensingBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -11,7 +11,7 @@ var Scratch3SoundBlocks = function (runtime) {
|
|||
|
||||
/**
|
||||
* Retrieve the block primitives implemented by this package.
|
||||
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
||||
* @return {object.<string, Function>} Mapping of opcode to Function.
|
||||
*/
|
||||
Scratch3SoundBlocks.prototype.getPrimitives = function () {
|
||||
return {
|
||||
|
|
|
@ -6,7 +6,7 @@ var html = require('htmlparser2');
|
|||
* to a usable form for the Scratch runtime.
|
||||
* This structure is based on Blockly xml.js:`domToWorkspace` and `domToBlock`.
|
||||
* @param {Element} blocksDOM DOM tree for this event.
|
||||
* @return {Array.<Object>} Usable list of blocks from this CREATE event.
|
||||
* @return {Array.<object>} Usable list of blocks from this CREATE event.
|
||||
*/
|
||||
var domToBlocks = function (blocksDOM) {
|
||||
// At this level, there could be multiple blocks adjacent in the DOM tree.
|
||||
|
@ -32,8 +32,8 @@ var domToBlocks = function (blocksDOM) {
|
|||
/**
|
||||
* Adapter between block creation events and block representation which can be
|
||||
* used by the Scratch runtime.
|
||||
* @param {Object} e `Blockly.events.create`
|
||||
* @return {Array.<Object>} List of blocks from this CREATE event.
|
||||
* @param {object} e `Blockly.events.create`
|
||||
* @return {Array.<object>} List of blocks from this CREATE event.
|
||||
*/
|
||||
var adapter = function (e) {
|
||||
// Validate input
|
||||
|
@ -47,8 +47,8 @@ var adapter = function (e) {
|
|||
* Convert and an individual block DOM to the representation tree.
|
||||
* Based on Blockly's `domToBlockHeadless_`.
|
||||
* @param {Element} blockDOM DOM tree for an individual block.
|
||||
* @param {Object} blocks Collection of blocks to add to.
|
||||
* @param {Boolean} isTopBlock Whether blocks at this level are "top blocks."
|
||||
* @param {object} blocks Collection of blocks to add to.
|
||||
* @param {boolean} isTopBlock Whether blocks at this level are "top blocks."
|
||||
* @param {?string} parent Parent block ID.
|
||||
* @return {undefined}
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@ Blocks.BRANCH_INPUT_PREFIX = 'SUBSTACK';
|
|||
/**
|
||||
* Provide an object with metadata for the requested block ID.
|
||||
* @param {!string} blockId ID of block we have stored.
|
||||
* @return {?Object} Metadata about the block, if it exists.
|
||||
* @return {?object} Metadata about the block, if it exists.
|
||||
*/
|
||||
Blocks.prototype.getBlock = function (blockId) {
|
||||
return this._blocks[blockId];
|
||||
|
@ -92,7 +92,7 @@ Blocks.prototype.getOpcode = function (id) {
|
|||
/**
|
||||
* Get all fields and their values for a block.
|
||||
* @param {?string} id ID of block to query.
|
||||
* @return {!Object} All fields and their values.
|
||||
* @return {!object} All fields and their values.
|
||||
*/
|
||||
Blocks.prototype.getFields = function (id) {
|
||||
var block = this._blocks[id];
|
||||
|
@ -102,7 +102,7 @@ Blocks.prototype.getFields = function (id) {
|
|||
/**
|
||||
* Get all non-branch inputs for a block.
|
||||
* @param {?string} id ID of block to query.
|
||||
* @return {!Object} All non-branch inputs and their associated blocks.
|
||||
* @return {!object} All non-branch inputs and their associated blocks.
|
||||
*/
|
||||
Blocks.prototype.getInputs = function (id) {
|
||||
var block = this._blocks[id];
|
||||
|
@ -121,7 +121,7 @@ Blocks.prototype.getInputs = function (id) {
|
|||
/**
|
||||
* Get mutation data for a block.
|
||||
* @param {?string} id ID of block to query.
|
||||
* @return {!Object} Mutation for the block.
|
||||
* @return {!object} Mutation for the block.
|
||||
*/
|
||||
Blocks.prototype.getMutation = function (id) {
|
||||
var block = this._blocks[id];
|
||||
|
@ -247,7 +247,7 @@ Blocks.prototype.blocklyListen = function (e, optRuntime) {
|
|||
|
||||
/**
|
||||
* Block management: create blocks and scripts from a `create` event
|
||||
* @param {!Object} block Blockly create event to be processed
|
||||
* @param {!object} block Blockly create event to be processed
|
||||
*/
|
||||
Blocks.prototype.createBlock = function (block) {
|
||||
// Does the block already exist?
|
||||
|
@ -267,7 +267,7 @@ Blocks.prototype.createBlock = function (block) {
|
|||
|
||||
/**
|
||||
* Block management: change block field values
|
||||
* @param {!Object} args Blockly change event to be processed
|
||||
* @param {!object} args Blockly change event to be processed
|
||||
*/
|
||||
Blocks.prototype.changeBlock = function (args) {
|
||||
// Validate
|
||||
|
@ -286,7 +286,7 @@ Blocks.prototype.changeBlock = function (args) {
|
|||
|
||||
/**
|
||||
* Block management: move blocks from parent to parent
|
||||
* @param {!Object} e Blockly move event to be processed
|
||||
* @param {!object} e Blockly move event to be processed
|
||||
*/
|
||||
Blocks.prototype.moveBlock = function (e) {
|
||||
if (!this._blocks.hasOwnProperty(e.id)) {
|
||||
|
@ -342,7 +342,7 @@ Blocks.prototype.moveBlock = function (e) {
|
|||
|
||||
/**
|
||||
* Block management: delete blocks and their associated scripts.
|
||||
* @param {!Object} e Blockly delete event to be processed.
|
||||
* @param {!object} e Blockly delete event to be processed.
|
||||
*/
|
||||
Blocks.prototype.deleteBlock = function (e) {
|
||||
// @todo In runtime, stop threads running on this script.
|
||||
|
@ -449,7 +449,7 @@ Blocks.prototype.blockToXML = function (blockId) {
|
|||
|
||||
/**
|
||||
* Recursively encode a mutation object to XML.
|
||||
* @param {!Object} mutation Object representing a mutation.
|
||||
* @param {!object} mutation Object representing a mutation.
|
||||
* @return {string} XML string representing a mutation.
|
||||
*/
|
||||
Blocks.prototype.mutationToXML = function (mutation) {
|
||||
|
|
|
@ -4,7 +4,7 @@ var Thread = require('./thread');
|
|||
/**
|
||||
* Utility function to determine if a value is a Promise.
|
||||
* @param {*} value Value to check for a Promise.
|
||||
* @return {Boolean} True if the value appears to be a Promise.
|
||||
* @return {boolean} True if the value appears to be a Promise.
|
||||
*/
|
||||
var isPromise = function (value) {
|
||||
return value && value.then && typeof value.then === 'function';
|
||||
|
|
|
@ -2,8 +2,8 @@ var html = require('htmlparser2');
|
|||
|
||||
/**
|
||||
* Convert a part of a mutation DOM to a mutation VM object, recursively.
|
||||
* @param {Object} dom DOM object for mutation tag.
|
||||
* @return {Object} Object representing useful parts of this mutation.
|
||||
* @param {object} dom DOM object for mutation tag.
|
||||
* @return {object} Object representing useful parts of this mutation.
|
||||
*/
|
||||
var mutatorTagToObject = function (dom) {
|
||||
var obj = Object.create(null);
|
||||
|
@ -24,8 +24,8 @@ var mutatorTagToObject = function (dom) {
|
|||
/**
|
||||
* Adapter between mutator XML or DOM and block representation which can be
|
||||
* used by the Scratch runtime.
|
||||
* @param {(Object|string)} mutation Mutation XML string or DOM.
|
||||
* @return {Object} Object representing the mutation.
|
||||
* @param {(object|string)} mutation Mutation XML string or DOM.
|
||||
* @return {object} Object representing the mutation.
|
||||
*/
|
||||
var mutationAdpater = function (mutation) {
|
||||
var mutationParsed;
|
||||
|
|
|
@ -276,7 +276,7 @@ Runtime.prototype.getOpcodeFunction = function (opcode) {
|
|||
/**
|
||||
* Return whether an opcode represents a hat block.
|
||||
* @param {!string} opcode The opcode to look up.
|
||||
* @return {Boolean} True if the op is known to be a hat.
|
||||
* @return {boolean} True if the op is known to be a hat.
|
||||
*/
|
||||
Runtime.prototype.getIsHat = function (opcode) {
|
||||
return this._hats.hasOwnProperty(opcode);
|
||||
|
@ -285,7 +285,7 @@ Runtime.prototype.getIsHat = function (opcode) {
|
|||
/**
|
||||
* Return whether an opcode represents an edge-activated hat block.
|
||||
* @param {!string} opcode The opcode to look up.
|
||||
* @return {Boolean} True if the op is known to be a edge-activated hat.
|
||||
* @return {boolean} True if the op is known to be a edge-activated hat.
|
||||
*/
|
||||
Runtime.prototype.getIsEdgeActivatedHat = function (opcode) {
|
||||
return this._hats.hasOwnProperty(opcode) &&
|
||||
|
@ -379,7 +379,7 @@ Runtime.prototype._restartThread = function (thread) {
|
|||
/**
|
||||
* Return whether a thread is currently active/running.
|
||||
* @param {?Thread} thread Thread object to check.
|
||||
* @return {Boolean} True if the thread is active/running.
|
||||
* @return {boolean} True if the thread is active/running.
|
||||
*/
|
||||
Runtime.prototype.isActiveThread = function (thread) {
|
||||
return this.threads.indexOf(thread) > -1;
|
||||
|
@ -427,7 +427,7 @@ Runtime.prototype.allScriptsDo = function (f, optTarget) {
|
|||
/**
|
||||
* Start all relevant hats.
|
||||
* @param {!string} requestedHatOpcode Opcode of hats to start.
|
||||
* @param {Object=} optMatchFields Optionally, fields to match on the hat.
|
||||
* @param {object=} optMatchFields Optionally, fields to match on the hat.
|
||||
* @param {Target=} optTarget Optionally, a target to restrict to.
|
||||
* @return {Array.<Thread>} List of threads started by this function.
|
||||
*/
|
||||
|
|
|
@ -171,8 +171,8 @@ Sequencer.prototype.stepThread = function (thread) {
|
|||
/**
|
||||
* Step a thread into a block's branch.
|
||||
* @param {!Thread} thread Thread object to step to branch.
|
||||
* @param {Number} branchNum Which branch to step to (i.e., 1, 2).
|
||||
* @param {Boolean} isLoop Whether this block is a loop.
|
||||
* @param {number} branchNum Which branch to step to (i.e., 1, 2).
|
||||
* @param {boolean} isLoop Whether this block is a loop.
|
||||
*/
|
||||
Sequencer.prototype.stepToBranch = function (thread, branchNum, isLoop) {
|
||||
if (!branchNum) {
|
||||
|
|
|
@ -151,7 +151,7 @@ Thread.prototype.peekStack = function () {
|
|||
|
||||
/**
|
||||
* Get top stack frame.
|
||||
* @return {?Object} Last stack frame stored on this thread.
|
||||
* @return {?object} Last stack frame stored on this thread.
|
||||
*/
|
||||
Thread.prototype.peekStackFrame = function () {
|
||||
return this.stackFrames.length > 0 ? this.stackFrames[this.stackFrames.length - 1] : null;
|
||||
|
@ -159,7 +159,7 @@ Thread.prototype.peekStackFrame = function () {
|
|||
|
||||
/**
|
||||
* Get stack frame above the current top.
|
||||
* @return {?Object} Second to last stack frame stored on this thread.
|
||||
* @return {?object} Second to last stack frame stored on this thread.
|
||||
*/
|
||||
Thread.prototype.peekParentStackFrame = function () {
|
||||
return this.stackFrames.length > 1 ? this.stackFrames[this.stackFrames.length - 2] : null;
|
||||
|
@ -205,7 +205,7 @@ Thread.prototype.getParam = function (paramName) {
|
|||
|
||||
/**
|
||||
* Whether the current execution of a thread is at the top of the stack.
|
||||
* @return {Boolean} True if execution is at top of the stack.
|
||||
* @return {boolean} True if execution is at top of the stack.
|
||||
*/
|
||||
Thread.prototype.atStackTop = function () {
|
||||
return this.peekStack() === this.topBlock;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
/**
|
||||
* @param {!string} name Name of the variable.
|
||||
* @param {(string|Number)} value Value of the variable.
|
||||
* @param {(string|number)} value Value of the variable.
|
||||
* @param {boolean} isCloud Whether the variable is stored in the cloud.
|
||||
* @constructor
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ var List = require('../engine/list');
|
|||
|
||||
/**
|
||||
* Parse a single "Scratch object" and create all its in-memory VM objects.
|
||||
* @param {!Object} object From-JSON "Scratch object:" sprite, stage, watcher.
|
||||
* @param {!object} object From-JSON "Scratch object:" sprite, stage, watcher.
|
||||
* @param {!Runtime} runtime Runtime object to load all structures into.
|
||||
* @param {boolean} topLevel Whether this is the top-level object (stage).
|
||||
* @return {?Target} Target created (stage or sprite).
|
||||
|
@ -138,7 +138,7 @@ var parseScratchObject = function (object, runtime, topLevel) {
|
|||
* and process the top-level object (the stage object).
|
||||
* @param {!string} json SB2-format JSON to load.
|
||||
* @param {!Runtime} runtime Runtime object to load all structures into.
|
||||
* @param {Boolean=} optForceSprite If set, treat as sprite (Sprite2).
|
||||
* @param {boolean=} optForceSprite If set, treat as sprite (Sprite2).
|
||||
* @return {?Target} Top-level target created (stage or sprite).
|
||||
*/
|
||||
var sb2import = function (json, runtime, optForceSprite) {
|
||||
|
@ -152,7 +152,7 @@ var sb2import = function (json, runtime, optForceSprite) {
|
|||
/**
|
||||
* Parse a Scratch object's scripts into VM blocks.
|
||||
* This should only handle top-level scripts that include X, Y coordinates.
|
||||
* @param {!Object} scripts Scripts object from SB2 JSON.
|
||||
* @param {!object} scripts Scripts object from SB2 JSON.
|
||||
* @param {!Blocks} blocks Blocks object to load parsed blocks into.
|
||||
*/
|
||||
var parseScripts = function (scripts, blocks) {
|
||||
|
@ -184,8 +184,8 @@ var parseScripts = function (scripts, blocks) {
|
|||
* Could be used to parse a top-level script,
|
||||
* a list of blocks in a branch (e.g., in forever),
|
||||
* or a list of blocks in an argument (e.g., move [pick random...]).
|
||||
* @param {Array.<Object>} blockList SB2 JSON-format block list.
|
||||
* @return {Array.<Object>} Scratch VM-format block list.
|
||||
* @param {Array.<object>} blockList SB2 JSON-format block list.
|
||||
* @return {Array.<object>} Scratch VM-format block list.
|
||||
*/
|
||||
var parseBlockList = function (blockList) {
|
||||
var resultingList = [];
|
||||
|
@ -207,8 +207,8 @@ var parseBlockList = function (blockList) {
|
|||
/**
|
||||
* Flatten a block tree into a block list.
|
||||
* Children are temporarily stored on the `block.children` property.
|
||||
* @param {Array.<Object>} blocks list generated by `parseBlockList`.
|
||||
* @return {Array.<Object>} Flattened list to be passed to `blocks.createBlock`.
|
||||
* @param {Array.<object>} blocks list generated by `parseBlockList`.
|
||||
* @return {Array.<object>} Flattened list to be passed to `blocks.createBlock`.
|
||||
*/
|
||||
var flatten = function (blocks) {
|
||||
var finalBlocks = [];
|
||||
|
@ -228,7 +228,7 @@ var flatten = function (blocks) {
|
|||
* into an argument map. This allows us to provide the expected inputs
|
||||
* to a mutated procedure call.
|
||||
* @param {string} procCode Scratch 2.0 procedure string.
|
||||
* @return {Object} Argument map compatible with those in sb2specmap.
|
||||
* @return {object} Argument map compatible with those in sb2specmap.
|
||||
*/
|
||||
var parseProcedureArgMap = function (procCode) {
|
||||
var argMap = [
|
||||
|
@ -259,8 +259,8 @@ var parseProcedureArgMap = function (procCode) {
|
|||
|
||||
/**
|
||||
* Parse a single SB2 JSON-formatted block and its children.
|
||||
* @param {!Object} sb2block SB2 JSON-formatted block.
|
||||
* @return {Object} Scratch VM format block.
|
||||
* @param {!object} sb2block SB2 JSON-formatted block.
|
||||
* @return {object} Scratch VM format block.
|
||||
*/
|
||||
var parseBlock = function (sb2block) {
|
||||
// First item in block object is the old opcode (e.g., 'forward:').
|
||||
|
|
|
@ -184,7 +184,7 @@ RenderedTarget.prototype.setXY = function (x, y) {
|
|||
|
||||
/**
|
||||
* Get the rendered direction and scale, after applying rotation style.
|
||||
* @return {Object<string, number>} Direction and scale to render.
|
||||
* @return {object<string, number>} Direction and scale to render.
|
||||
*/
|
||||
RenderedTarget.prototype._getRenderedDirectionAndScale = function () {
|
||||
// Default: no changes to `this.direction` or `this.scale`.
|
||||
|
@ -480,7 +480,7 @@ RenderedTarget.prototype.isSprite = function () {
|
|||
/**
|
||||
* Return the rendered target's tight bounding box.
|
||||
* Includes top, left, bottom, right attributes in Scratch coordinates.
|
||||
* @return {?Object} Tight bounding box, or null.
|
||||
* @return {?object} Tight bounding box, or null.
|
||||
*/
|
||||
RenderedTarget.prototype.getBounds = function () {
|
||||
if (this.renderer) {
|
||||
|
@ -493,7 +493,7 @@ RenderedTarget.prototype.getBounds = function () {
|
|||
* Return whether touching a point.
|
||||
* @param {number} x X coordinate of test point.
|
||||
* @param {number} y Y coordinate of test point.
|
||||
* @return {Boolean} True iff the rendered target is touching the point.
|
||||
* @return {boolean} True iff the rendered target is touching the point.
|
||||
*/
|
||||
RenderedTarget.prototype.isTouchingPoint = function (x, y) {
|
||||
if (this.renderer) {
|
||||
|
@ -513,7 +513,7 @@ RenderedTarget.prototype.isTouchingPoint = function (x, y) {
|
|||
|
||||
/**
|
||||
* Return whether touching a stage edge.
|
||||
* @return {Boolean} True iff the rendered target is touching the stage edge.
|
||||
* @return {boolean} True iff the rendered target is touching the stage edge.
|
||||
*/
|
||||
RenderedTarget.prototype.isTouchingEdge = function () {
|
||||
if (this.renderer) {
|
||||
|
@ -533,7 +533,7 @@ RenderedTarget.prototype.isTouchingEdge = function () {
|
|||
/**
|
||||
* Return whether touching any of a named sprite's clones.
|
||||
* @param {string} spriteName Name of the sprite.
|
||||
* @return {Boolean} True iff touching a clone of the sprite.
|
||||
* @return {boolean} True iff touching a clone of the sprite.
|
||||
*/
|
||||
RenderedTarget.prototype.isTouchingSprite = function (spriteName) {
|
||||
var firstClone = this.runtime.getSpriteTargetByName(spriteName);
|
||||
|
@ -550,7 +550,7 @@ RenderedTarget.prototype.isTouchingSprite = function (spriteName) {
|
|||
/**
|
||||
* Return whether touching a color.
|
||||
* @param {Array.<number>} rgb [r,g,b], values between 0-255.
|
||||
* @return {Promise.<Boolean>} True iff the rendered target is touching the color.
|
||||
* @return {Promise.<boolean>} True iff the rendered target is touching the color.
|
||||
*/
|
||||
RenderedTarget.prototype.isTouchingColor = function (rgb) {
|
||||
if (this.renderer) {
|
||||
|
@ -561,9 +561,9 @@ RenderedTarget.prototype.isTouchingColor = function (rgb) {
|
|||
|
||||
/**
|
||||
* Return whether rendered target's color is touching a color.
|
||||
* @param {Object} targetRgb {Array.<number>} [r,g,b], values between 0-255.
|
||||
* @param {Object} maskRgb {Array.<number>} [r,g,b], values between 0-255.
|
||||
* @return {Promise.<Boolean>} True iff the color is touching the color.
|
||||
* @param {object} targetRgb {Array.<number>} [r,g,b], values between 0-255.
|
||||
* @param {object} maskRgb {Array.<number>} [r,g,b], values between 0-255.
|
||||
* @return {Promise.<boolean>} True iff the color is touching the color.
|
||||
*/
|
||||
RenderedTarget.prototype.colorIsTouchingColor = function (targetRgb, maskRgb) {
|
||||
if (this.renderer) {
|
||||
|
@ -611,7 +611,7 @@ RenderedTarget.prototype.goBehindOther = function (other) {
|
|||
* Keep a desired position within a fence.
|
||||
* @param {number} newX New desired X position.
|
||||
* @param {number} newY New desired Y position.
|
||||
* @param {Object=} optFence Optional fence with left, right, top bottom.
|
||||
* @param {object=} optFence Optional fence with left, right, top bottom.
|
||||
* @return {Array.<number>} Fenced X and Y coordinates.
|
||||
*/
|
||||
RenderedTarget.prototype.keepInFence = function (newX, newY, optFence) {
|
||||
|
|
|
@ -95,7 +95,7 @@ Cast.toRgbColorObject = function (value) {
|
|||
* In Scratch 2.0, this is captured by `interp.compare.`
|
||||
* @param {*} v1 First value to compare.
|
||||
* @param {*} v2 Second value to compare.
|
||||
* @returns {Number} Negative number if v1 < v2; 0 if equal; positive otherwise.
|
||||
* @returns {number} Negative number if v1 < v2; 0 if equal; positive otherwise.
|
||||
*/
|
||||
Cast.compare = function (v1, v2) {
|
||||
var n1 = Number(v1);
|
||||
|
|
|
@ -75,7 +75,7 @@ VirtualMachine.prototype.greenFlag = function () {
|
|||
/**
|
||||
* Set whether the VM is in "turbo mode."
|
||||
* When true, loops don't yield to redraw.
|
||||
* @param {Boolean} turboModeOn Whether turbo mode should be set.
|
||||
* @param {boolean} turboModeOn Whether turbo mode should be set.
|
||||
*/
|
||||
VirtualMachine.prototype.setTurboMode = function (turboModeOn) {
|
||||
this.runtime.turboMode = !!turboModeOn;
|
||||
|
@ -84,7 +84,7 @@ VirtualMachine.prototype.setTurboMode = function (turboModeOn) {
|
|||
/**
|
||||
* Set whether the VM is in 2.0 "compatibility mode."
|
||||
* When true, ticks go at 2.0 speed (30 TPS).
|
||||
* @param {Boolean} compatibilityModeOn Whether compatibility mode is set.
|
||||
* @param {boolean} compatibilityModeOn Whether compatibility mode is set.
|
||||
*/
|
||||
VirtualMachine.prototype.setCompatibilityMode = function (compatibilityModeOn) {
|
||||
this.runtime.setCompatibilityMode(!!compatibilityModeOn);
|
||||
|
@ -129,7 +129,7 @@ VirtualMachine.prototype.getPlaygroundData = function () {
|
|||
/**
|
||||
* Post I/O data to the virtual devices.
|
||||
* @param {?string} device Name of virtual I/O device.
|
||||
* @param {Object} data Any data object to post to the I/O device.
|
||||
* @param {object} data Any data object to post to the I/O device.
|
||||
*/
|
||||
VirtualMachine.prototype.postIOData = function (device, data) {
|
||||
if (this.runtime.ioDevices[device]) {
|
||||
|
@ -168,7 +168,7 @@ VirtualMachine.prototype.addSprite2 = function (json) {
|
|||
|
||||
/**
|
||||
* Add a costume to the current editing target.
|
||||
* @param {!Object} costumeObject Object representing the costume.
|
||||
* @param {!object} costumeObject Object representing the costume.
|
||||
*/
|
||||
VirtualMachine.prototype.addCostume = function (costumeObject) {
|
||||
this.editingTarget.sprite.costumes.push(costumeObject);
|
||||
|
@ -180,7 +180,7 @@ VirtualMachine.prototype.addCostume = function (costumeObject) {
|
|||
|
||||
/**
|
||||
* Add a backdrop to the stage.
|
||||
* @param {!Object} backdropObject Object representing the backdrop.
|
||||
* @param {!object} backdropObject Object representing the backdrop.
|
||||
*/
|
||||
VirtualMachine.prototype.addBackdrop = function (backdropObject) {
|
||||
var stage = this.runtime.getTargetForStage();
|
||||
|
|
Loading…
Reference in a new issue