Global

Members

BlockPyInterface

An automatically generated file, based on interface.html. An interesting problem in web development is managing HTML code in JS files. Rather than embedding string literals and concatenating them, or some other hackish soluion, we simply convert an HTML file to a JS string. Therefore, relevant edits should be in interface.html instead. The BlockPyInterface global can be seen as a constant representation of the default interface.
Source:

EXTENDED_ERROR_EXPLANATION

A dictionary of improved explanations for Python errors. These are shown to users alongside the regular errors to hopefully increase clarity.
Source:

timerGuard

Attempts to update the model for the current code file from the text editor. Might be prevented if an update event was already percolating. Also unhighlights any lines.
Source:

Methods

cloneNode(node) → {Node}

Deeply clones a node
Parameters:
Name Type Description
node Node A node to clone
Source:
Returns:
A clone of the given node and all its children
Type
Node

encodeHTML(str) → {string}

Encodes some text so that it can be safely written into an HTML box. This includes replacing special HTML characters (&, <, >, etc.).
Parameters:
Name Type Description
str string The text to be converted.
Source:
Returns:
The HTML-safe text.
Type
string

expandArray(array, addArray, removeArray) → {Array}

A helper function for extending an array based on an "addArray" and "removeArray". Any element found in removeArray is removed from the first array and all the elements of addArray are added. Creates a new array, so is non-destructive.
Parameters:
Name Type Description
array Array the array to manipulate
addArray Array the elements to add to the array
removeArray Array the elements to remove from the array
Source:
Returns:
The modified array
Type
Array

indent(str) → {String}

Indents the given string by 4 spaces. This correctly handles multi-line strings.
Parameters:
Name Type Description
str String The string to be manipulated.
Source:
Returns:
The string with four spaces added at the start of every new line.
Type
String

indent(str, numOfIndents, opt_spacesPerIndentopt) → {string}

Indents the given string
Parameters:
Name Type Attributes Description
str string The string to be indented.
numOfIndents number The amount of indentations to place at the beginning of each line of the string.
opt_spacesPerIndent number <optional>
Optional. If specified, this should be the number of spaces to be used for each tab that would ordinarily be used to indent the text. These amount of spaces will also be used to replace any tab characters that already exist within the string.
Source:
Returns:
The new string with each line beginning with the desired amount of indentation.
Type
string

instructor_module(name)

Skulpt Module for holding the Instructor API. This module is a little hackish. We need to sit down and reevaluate the best way to organize it and whether this particular structure is ideal. I suspect it should be it's own proper JS file.
Parameters:
Name Type Description
name String The name of the module (should always be 'instructor')
Source:

prettyPrintDateTime(timeString) → {String}

Helper function to parse a date/time string and rewrite it as something more human readable.
Parameters:
Name Type Description
timeString String the string representation of time ("YYYYMMDD HHMMSS")
Source:
Returns:
- A human-readable time string.
Type
String

randomInteger(min, max) → {number}

Return a random integer between [`min`, `max`].
Parameters:
Name Type Description
min number The lowest possible integer.
max number The highest possible integer (inclusive).
Source:
Returns:
A random integer.
Type
number

set_button_loaded(btn)

This is a very simplistic helper function that will transform a given button into a "Loaded" state (disabled, pressed state, etc.).
Parameters:
Name Type Description
btn HTMLElement An HTML element to change the text of.
Source: