GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — scratch-vm/src/engine/variable.js at develop · SnoopyMod/scratch-vm Expand file tree/ Copy pathvariable.jsMore file actions 70 lines (63 loc) · 1.76 KB / Copy pathvariable.jsFile metadata and controls70 lines (63 loc) · 1.76 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 /** * @fileoverview * Object representing a Scratch variable. */ const uid = require('../util/uid'); const xmlEscape = require('../util/xml-escape'); class Variable { /** * @param {string} id Id of the variable. * @param {string} name Name of the variable. * @param {string} type Type of the variable, one of '' or 'list' * @param {boolean} isCloud Whether the variable is stored in the cloud. * @constructor */ constructor (id, name, type, isCloud) { this.id = id || uid(); this.name = name; this.type = type; this.isCloud = isCloud; switch (this.type) { case Variable.SCALAR_TYPE: this.value = 0; break; case Variable.LIST_TYPE: this.value = []; break; case Variable.BROADCAST_MESSAGE_TYPE: this.value = this.name; break; default: throw new Error(`Invalid variable type: ${this.type}`); } } toXML (isLocal) { isLocal = (isLocal === true); return `<variable type="${this.type}" id="${this.id}" islocal="${isLocal }" iscloud="${this.isCloud}">${xmlEscape(this.name)}</variable>`; } /** * Type representation for scalar variables. * This is currently represented as '' * for compatibility with blockly. * @const {string} */ static get SCALAR_TYPE () { return ''; } /** * Type representation for list variables. * @const {string} */ static get LIST_TYPE () { return 'list'; } /** * Type representation for list variables. * @const {string} */ static get BROADCAST_MESSAGE_TYPE () { return 'broadcast_msg'; } } module.exports = Variable; |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |