Home

112.js

The CMU Unlocked API.

Provides an HTML DOM interface using concepts similar to those taught in Fundamentals of Programming and Computer Science (CMU 15-112).
The architecture is inspired by the p5 project, and implemented using jQuery.

Each exercise folder that uses the API should have a config file named "ex.data.json" which contains a meta field, specifying metadata such as authorship, title, description, id, and dependencies. See the documentation on ex.data for more information. Each exercise should also contain a file named "main.js". Inside "main.js" there should exist a function function main(ex). The API can be used inside that function.

The API provides DOM creation methods, such as ex.createButton, that return instances of Element112. This is an object that contains standard methods such as .style(), .hide() , etc. Each method returns the calling object, so the methods are chainable.

Element112's get default styling, if not otherwise specified. These styles are contained in ex.defaults.

The API also provides a default canvas in the ex.graphics module. ex.graphics.ctx is a initialized to a default 2d rendering context.

The field ex.data.meta.mode contains the string "practice", "quiz-immediate" or "quiz-delay". This specifies the mode of the exercise.

When an exercise is unloaded and then loaded, all basic types inside ex.data are saved. Basic types include objects,lists, strings, etc. Exercise creators should use ex.data to save the state of an exercise, meaning if the exercise is unloaded and the reloaded, it should be in the same state.

Exercise instructions are made in a file instr.html. This file should be created by the exercise developer. Anything in instr.html will be loaded into the instructions modal.

The kitchen sink is a great place to start!
Version:
  • 0.3
Author:
  • <a href="mailto:edryer@andrew.cmu.edu">Edward Dryer</a>
  • <a href="mailto:richardz@andrew.cmu.edu">Richard Zhao</a>
Source: