Lint for eslint-config-scratch@3

This commit is contained in:
Ray Schamp 2017-02-01 15:59:50 -05:00
parent a6568c4bf2
commit 727fcc7875
22 changed files with 65 additions and 65 deletions

View file

@ -11,7 +11,7 @@ var Scratch3ControlBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3ControlBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -10,7 +10,7 @@ var Scratch3DataBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3DataBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -10,7 +10,7 @@ var Scratch3EventBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3EventBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -10,7 +10,7 @@ var Scratch3LooksBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3LooksBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -12,7 +12,7 @@ var Scratch3MotionBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3MotionBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -11,7 +11,7 @@ var Scratch3OperatorsBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3OperatorsBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -163,7 +163,7 @@ Scratch3PenBlocks.prototype._wrapHueOrShade = function (value) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3PenBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -8,7 +8,7 @@ var Scratch3ProcedureBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3ProcedureBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -10,7 +10,7 @@ var Scratch3SensingBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3SensingBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -11,7 +11,7 @@ var Scratch3SoundBlocks = function (runtime) {
/** /**
* Retrieve the block primitives implemented by this package. * 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 () { Scratch3SoundBlocks.prototype.getPrimitives = function () {
return { return {

View file

@ -6,7 +6,7 @@ var html = require('htmlparser2');
* to a usable form for the Scratch runtime. * to a usable form for the Scratch runtime.
* This structure is based on Blockly xml.js:`domToWorkspace` and `domToBlock`. * This structure is based on Blockly xml.js:`domToWorkspace` and `domToBlock`.
* @param {Element} blocksDOM DOM tree for this event. * @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) { var domToBlocks = function (blocksDOM) {
// At this level, there could be multiple blocks adjacent in the DOM tree. // 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 * Adapter between block creation events and block representation which can be
* used by the Scratch runtime. * used by the Scratch runtime.
* @param {Object} e `Blockly.events.create` * @param {object} e `Blockly.events.create`
* @return {Array.<Object>} List of blocks from this CREATE event. * @return {Array.<object>} List of blocks from this CREATE event.
*/ */
var adapter = function (e) { var adapter = function (e) {
// Validate input // Validate input
@ -47,8 +47,8 @@ var adapter = function (e) {
* Convert and an individual block DOM to the representation tree. * Convert and an individual block DOM to the representation tree.
* Based on Blockly's `domToBlockHeadless_`. * Based on Blockly's `domToBlockHeadless_`.
* @param {Element} blockDOM DOM tree for an individual block. * @param {Element} blockDOM DOM tree for an individual block.
* @param {Object} blocks Collection of blocks to add to. * @param {object} blocks Collection of blocks to add to.
* @param {Boolean} isTopBlock Whether blocks at this level are "top blocks." * @param {boolean} isTopBlock Whether blocks at this level are "top blocks."
* @param {?string} parent Parent block ID. * @param {?string} parent Parent block ID.
* @return {undefined} * @return {undefined}
*/ */

View file

@ -34,7 +34,7 @@ Blocks.BRANCH_INPUT_PREFIX = 'SUBSTACK';
/** /**
* Provide an object with metadata for the requested block ID. * Provide an object with metadata for the requested block ID.
* @param {!string} blockId ID of block we have stored. * @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) { Blocks.prototype.getBlock = function (blockId) {
return this._blocks[blockId]; return this._blocks[blockId];
@ -92,7 +92,7 @@ Blocks.prototype.getOpcode = function (id) {
/** /**
* Get all fields and their values for a block. * Get all fields and their values for a block.
* @param {?string} id ID of block to query. * @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) { Blocks.prototype.getFields = function (id) {
var block = this._blocks[id]; var block = this._blocks[id];
@ -102,7 +102,7 @@ Blocks.prototype.getFields = function (id) {
/** /**
* Get all non-branch inputs for a block. * Get all non-branch inputs for a block.
* @param {?string} id ID of block to query. * @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) { Blocks.prototype.getInputs = function (id) {
var block = this._blocks[id]; var block = this._blocks[id];
@ -121,7 +121,7 @@ Blocks.prototype.getInputs = function (id) {
/** /**
* Get mutation data for a block. * Get mutation data for a block.
* @param {?string} id ID of block to query. * @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) { Blocks.prototype.getMutation = function (id) {
var block = this._blocks[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 * 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) { Blocks.prototype.createBlock = function (block) {
// Does the block already exist? // Does the block already exist?
@ -267,7 +267,7 @@ Blocks.prototype.createBlock = function (block) {
/** /**
* Block management: change block field values * 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) { Blocks.prototype.changeBlock = function (args) {
// Validate // Validate
@ -286,7 +286,7 @@ Blocks.prototype.changeBlock = function (args) {
/** /**
* Block management: move blocks from parent to parent * 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) { Blocks.prototype.moveBlock = function (e) {
if (!this._blocks.hasOwnProperty(e.id)) { if (!this._blocks.hasOwnProperty(e.id)) {
@ -342,7 +342,7 @@ Blocks.prototype.moveBlock = function (e) {
/** /**
* Block management: delete blocks and their associated scripts. * 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) { Blocks.prototype.deleteBlock = function (e) {
// @todo In runtime, stop threads running on this script. // @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. * 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. * @return {string} XML string representing a mutation.
*/ */
Blocks.prototype.mutationToXML = function (mutation) { Blocks.prototype.mutationToXML = function (mutation) {

View file

@ -4,7 +4,7 @@ var Thread = require('./thread');
/** /**
* Utility function to determine if a value is a Promise. * Utility function to determine if a value is a Promise.
* @param {*} value Value to check for 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) { var isPromise = function (value) {
return value && value.then && typeof value.then === 'function'; return value && value.then && typeof value.then === 'function';

View file

@ -2,8 +2,8 @@ var html = require('htmlparser2');
/** /**
* Convert a part of a mutation DOM to a mutation VM object, recursively. * Convert a part of a mutation DOM to a mutation VM object, recursively.
* @param {Object} dom DOM object for mutation tag. * @param {object} dom DOM object for mutation tag.
* @return {Object} Object representing useful parts of this mutation. * @return {object} Object representing useful parts of this mutation.
*/ */
var mutatorTagToObject = function (dom) { var mutatorTagToObject = function (dom) {
var obj = Object.create(null); 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 * Adapter between mutator XML or DOM and block representation which can be
* used by the Scratch runtime. * used by the Scratch runtime.
* @param {(Object|string)} mutation Mutation XML string or DOM. * @param {(object|string)} mutation Mutation XML string or DOM.
* @return {Object} Object representing the mutation. * @return {object} Object representing the mutation.
*/ */
var mutationAdpater = function (mutation) { var mutationAdpater = function (mutation) {
var mutationParsed; var mutationParsed;

View file

@ -276,7 +276,7 @@ Runtime.prototype.getOpcodeFunction = function (opcode) {
/** /**
* Return whether an opcode represents a hat block. * Return whether an opcode represents a hat block.
* @param {!string} opcode The opcode to look up. * @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) { Runtime.prototype.getIsHat = function (opcode) {
return this._hats.hasOwnProperty(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. * Return whether an opcode represents an edge-activated hat block.
* @param {!string} opcode The opcode to look up. * @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) { Runtime.prototype.getIsEdgeActivatedHat = function (opcode) {
return this._hats.hasOwnProperty(opcode) && return this._hats.hasOwnProperty(opcode) &&
@ -379,7 +379,7 @@ Runtime.prototype._restartThread = function (thread) {
/** /**
* Return whether a thread is currently active/running. * Return whether a thread is currently active/running.
* @param {?Thread} thread Thread object to check. * @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) { Runtime.prototype.isActiveThread = function (thread) {
return this.threads.indexOf(thread) > -1; return this.threads.indexOf(thread) > -1;
@ -427,7 +427,7 @@ Runtime.prototype.allScriptsDo = function (f, optTarget) {
/** /**
* Start all relevant hats. * Start all relevant hats.
* @param {!string} requestedHatOpcode Opcode of hats to start. * @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. * @param {Target=} optTarget Optionally, a target to restrict to.
* @return {Array.<Thread>} List of threads started by this function. * @return {Array.<Thread>} List of threads started by this function.
*/ */

View file

@ -171,8 +171,8 @@ Sequencer.prototype.stepThread = function (thread) {
/** /**
* Step a thread into a block's branch. * Step a thread into a block's branch.
* @param {!Thread} thread Thread object to step to branch. * @param {!Thread} thread Thread object to step to branch.
* @param {Number} branchNum Which branch to step to (i.e., 1, 2). * @param {number} branchNum Which branch to step to (i.e., 1, 2).
* @param {Boolean} isLoop Whether this block is a loop. * @param {boolean} isLoop Whether this block is a loop.
*/ */
Sequencer.prototype.stepToBranch = function (thread, branchNum, isLoop) { Sequencer.prototype.stepToBranch = function (thread, branchNum, isLoop) {
if (!branchNum) { if (!branchNum) {

View file

@ -151,7 +151,7 @@ Thread.prototype.peekStack = function () {
/** /**
* Get top stack frame. * 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 () { Thread.prototype.peekStackFrame = function () {
return this.stackFrames.length > 0 ? this.stackFrames[this.stackFrames.length - 1] : null; 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. * 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 () { Thread.prototype.peekParentStackFrame = function () {
return this.stackFrames.length > 1 ? this.stackFrames[this.stackFrames.length - 2] : null; 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. * 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 () { Thread.prototype.atStackTop = function () {
return this.peekStack() === this.topBlock; return this.peekStack() === this.topBlock;

View file

@ -5,7 +5,7 @@
/** /**
* @param {!string} name Name of the variable. * @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. * @param {boolean} isCloud Whether the variable is stored in the cloud.
* @constructor * @constructor
*/ */

View file

@ -17,7 +17,7 @@ var List = require('../engine/list');
/** /**
* Parse a single "Scratch object" and create all its in-memory VM objects. * 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 {!Runtime} runtime Runtime object to load all structures into.
* @param {boolean} topLevel Whether this is the top-level object (stage). * @param {boolean} topLevel Whether this is the top-level object (stage).
* @return {?Target} Target created (stage or sprite). * @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). * and process the top-level object (the stage object).
* @param {!string} json SB2-format JSON to load. * @param {!string} json SB2-format JSON to load.
* @param {!Runtime} runtime Runtime object to load all structures into. * @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). * @return {?Target} Top-level target created (stage or sprite).
*/ */
var sb2import = function (json, runtime, optForceSprite) { 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. * Parse a Scratch object's scripts into VM blocks.
* This should only handle top-level scripts that include X, Y coordinates. * 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. * @param {!Blocks} blocks Blocks object to load parsed blocks into.
*/ */
var parseScripts = function (scripts, blocks) { var parseScripts = function (scripts, blocks) {
@ -184,8 +184,8 @@ var parseScripts = function (scripts, blocks) {
* Could be used to parse a top-level script, * Could be used to parse a top-level script,
* a list of blocks in a branch (e.g., in forever), * a list of blocks in a branch (e.g., in forever),
* or a list of blocks in an argument (e.g., move [pick random...]). * or a list of blocks in an argument (e.g., move [pick random...]).
* @param {Array.<Object>} blockList SB2 JSON-format block list. * @param {Array.<object>} blockList SB2 JSON-format block list.
* @return {Array.<Object>} Scratch VM-format block list. * @return {Array.<object>} Scratch VM-format block list.
*/ */
var parseBlockList = function (blockList) { var parseBlockList = function (blockList) {
var resultingList = []; var resultingList = [];
@ -207,8 +207,8 @@ var parseBlockList = function (blockList) {
/** /**
* Flatten a block tree into a block list. * Flatten a block tree into a block list.
* Children are temporarily stored on the `block.children` property. * Children are temporarily stored on the `block.children` property.
* @param {Array.<Object>} blocks list generated by `parseBlockList`. * @param {Array.<object>} blocks list generated by `parseBlockList`.
* @return {Array.<Object>} Flattened list to be passed to `blocks.createBlock`. * @return {Array.<object>} Flattened list to be passed to `blocks.createBlock`.
*/ */
var flatten = function (blocks) { var flatten = function (blocks) {
var finalBlocks = []; var finalBlocks = [];
@ -228,7 +228,7 @@ var flatten = function (blocks) {
* into an argument map. This allows us to provide the expected inputs * into an argument map. This allows us to provide the expected inputs
* to a mutated procedure call. * to a mutated procedure call.
* @param {string} procCode Scratch 2.0 procedure string. * @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 parseProcedureArgMap = function (procCode) {
var argMap = [ var argMap = [
@ -259,8 +259,8 @@ var parseProcedureArgMap = function (procCode) {
/** /**
* Parse a single SB2 JSON-formatted block and its children. * Parse a single SB2 JSON-formatted block and its children.
* @param {!Object} sb2block SB2 JSON-formatted block. * @param {!object} sb2block SB2 JSON-formatted block.
* @return {Object} Scratch VM format block. * @return {object} Scratch VM format block.
*/ */
var parseBlock = function (sb2block) { var parseBlock = function (sb2block) {
// First item in block object is the old opcode (e.g., 'forward:'). // First item in block object is the old opcode (e.g., 'forward:').

View file

@ -184,7 +184,7 @@ RenderedTarget.prototype.setXY = function (x, y) {
/** /**
* Get the rendered direction and scale, after applying rotation style. * 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 () { RenderedTarget.prototype._getRenderedDirectionAndScale = function () {
// Default: no changes to `this.direction` or `this.scale`. // 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. * Return the rendered target's tight bounding box.
* Includes top, left, bottom, right attributes in Scratch coordinates. * 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 () { RenderedTarget.prototype.getBounds = function () {
if (this.renderer) { if (this.renderer) {
@ -493,7 +493,7 @@ RenderedTarget.prototype.getBounds = function () {
* Return whether touching a point. * Return whether touching a point.
* @param {number} x X coordinate of test point. * @param {number} x X coordinate of test point.
* @param {number} y Y 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) { RenderedTarget.prototype.isTouchingPoint = function (x, y) {
if (this.renderer) { if (this.renderer) {
@ -513,7 +513,7 @@ RenderedTarget.prototype.isTouchingPoint = function (x, y) {
/** /**
* Return whether touching a stage edge. * 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 () { RenderedTarget.prototype.isTouchingEdge = function () {
if (this.renderer) { if (this.renderer) {
@ -533,7 +533,7 @@ RenderedTarget.prototype.isTouchingEdge = function () {
/** /**
* Return whether touching any of a named sprite's clones. * Return whether touching any of a named sprite's clones.
* @param {string} spriteName Name of the sprite. * @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) { RenderedTarget.prototype.isTouchingSprite = function (spriteName) {
var firstClone = this.runtime.getSpriteTargetByName(spriteName); var firstClone = this.runtime.getSpriteTargetByName(spriteName);
@ -550,7 +550,7 @@ RenderedTarget.prototype.isTouchingSprite = function (spriteName) {
/** /**
* Return whether touching a color. * Return whether touching a color.
* @param {Array.<number>} rgb [r,g,b], values between 0-255. * @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) { RenderedTarget.prototype.isTouchingColor = function (rgb) {
if (this.renderer) { if (this.renderer) {
@ -561,9 +561,9 @@ RenderedTarget.prototype.isTouchingColor = function (rgb) {
/** /**
* Return whether rendered target's color is touching a color. * Return whether rendered target's color is touching a color.
* @param {Object} targetRgb {Array.<number>} [r,g,b], values between 0-255. * @param {object} targetRgb {Array.<number>} [r,g,b], values between 0-255.
* @param {Object} maskRgb {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. * @return {Promise.<boolean>} True iff the color is touching the color.
*/ */
RenderedTarget.prototype.colorIsTouchingColor = function (targetRgb, maskRgb) { RenderedTarget.prototype.colorIsTouchingColor = function (targetRgb, maskRgb) {
if (this.renderer) { if (this.renderer) {
@ -611,7 +611,7 @@ RenderedTarget.prototype.goBehindOther = function (other) {
* Keep a desired position within a fence. * Keep a desired position within a fence.
* @param {number} newX New desired X position. * @param {number} newX New desired X position.
* @param {number} newY New desired Y 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. * @return {Array.<number>} Fenced X and Y coordinates.
*/ */
RenderedTarget.prototype.keepInFence = function (newX, newY, optFence) { RenderedTarget.prototype.keepInFence = function (newX, newY, optFence) {

View file

@ -95,7 +95,7 @@ Cast.toRgbColorObject = function (value) {
* In Scratch 2.0, this is captured by `interp.compare.` * In Scratch 2.0, this is captured by `interp.compare.`
* @param {*} v1 First value to compare. * @param {*} v1 First value to compare.
* @param {*} v2 Second 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) { Cast.compare = function (v1, v2) {
var n1 = Number(v1); var n1 = Number(v1);

View file

@ -75,7 +75,7 @@ VirtualMachine.prototype.greenFlag = function () {
/** /**
* Set whether the VM is in "turbo mode." * Set whether the VM is in "turbo mode."
* When true, loops don't yield to redraw. * 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) { VirtualMachine.prototype.setTurboMode = function (turboModeOn) {
this.runtime.turboMode = !!turboModeOn; this.runtime.turboMode = !!turboModeOn;
@ -84,7 +84,7 @@ VirtualMachine.prototype.setTurboMode = function (turboModeOn) {
/** /**
* Set whether the VM is in 2.0 "compatibility mode." * Set whether the VM is in 2.0 "compatibility mode."
* When true, ticks go at 2.0 speed (30 TPS). * 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) { VirtualMachine.prototype.setCompatibilityMode = function (compatibilityModeOn) {
this.runtime.setCompatibilityMode(!!compatibilityModeOn); this.runtime.setCompatibilityMode(!!compatibilityModeOn);
@ -129,7 +129,7 @@ VirtualMachine.prototype.getPlaygroundData = function () {
/** /**
* Post I/O data to the virtual devices. * Post I/O data to the virtual devices.
* @param {?string} device Name of virtual I/O device. * @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) { VirtualMachine.prototype.postIOData = function (device, data) {
if (this.runtime.ioDevices[device]) { if (this.runtime.ioDevices[device]) {
@ -168,7 +168,7 @@ VirtualMachine.prototype.addSprite2 = function (json) {
/** /**
* Add a costume to the current editing target. * 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) { VirtualMachine.prototype.addCostume = function (costumeObject) {
this.editingTarget.sprite.costumes.push(costumeObject); this.editingTarget.sprite.costumes.push(costumeObject);
@ -180,7 +180,7 @@ VirtualMachine.prototype.addCostume = function (costumeObject) {
/** /**
* Add a backdrop to the stage. * 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) { VirtualMachine.prototype.addBackdrop = function (backdropObject) {
var stage = this.runtime.getTargetForStage(); var stage = this.runtime.getTargetForStage();