Skip to content

Creating a New File

MaryS94 edited this page Feb 29, 2016 · 1 revision

Here is how to add a new file to ./blockly/accessibleBlockly through closure.

  1. Create the file in the accessibleBlockly folder
    ./blockly/accessibleBlockly/newFile.js

  2. At the top of the file write:
    goog.provide('Blockly.Accessibility.NewFile');
    goog.require('Blockly.Accessibility');

  3. Open ./blockly/blockly_uncompressed.js

  4. Search for "accessible" or scroll to about line 178.

  5. Add to the end of the list of dependencies for accessibleBlockly as follows:
    goog.addDependency("../../../" + dir + "/accessibleblockly/newFile.js", ['Blockly.Accessibility.NewFile'], []);

  6. Scroll to line 228 and add to the list of requires: goog.require('Blockly.Accessibility.NewFile');

  7. You're done! Now if you want to call functions from your file in any other file simply put goog.require('Blockly.Accessibility.NewFile'); at the top of that file and call Blockly.Accessibility.NewFile.method() and vice versa.

Clone this wiki locally