File Index
-
example.js
To get started with nclosure you will need to do the following:- Load nclosure through Node's standard mechanism
i.e. [var nclosure = require('nclosure')].
- Initialise nclosure:
i.e. [require('nclosure').nclosure(options)]
Note: Before initialisation no closure librarues can be used.
The nclosure() method takes in an optional options object with the following properties:
{ // Location of the closure-library directory closureBasePath:{string}, // Any additional dependency files required to run your code. These // files generally point to other closure libraries. Note these deps // files must have paths relative to the same closureBasePath as // specified above additionalDeps:{Array.
}, // Path to the compiler jar you want to use. Default: 'compiler.jar'. compiler_jar: {string}, // Additional compiler options, e.g: --jscomp_warning=newWarningType additionalCompileOptions: {Array. }, // These are directories containing source code that needs to be // included in the compilation. If this is not included then // additionalDeps is used to try to guess any additional roots // required (assumes that the deps.js file is in the root folder of // the source directory). additionalCompileRoots: {Array. } } - You can also place a closure.json file in the root directory of your source code that will allow you to call the init method with no parameters. Using a closure.json is highly recommended as this will allow you to use other tools such as jsdoc-toolkit and give you more configuration over other settings. See the example closure.json file included in this directory.
- Use closure library depenencies as required
i.e. [goog.require( 'goog.async.Delay' )].
- Load nclosure through Node's standard mechanism