-
Notifications
You must be signed in to change notification settings - Fork 16
Using ConstraintJS
ConstraintJS works in both client-side browser JavaScript (e.g. Chrome, IE, & Firefox) and server-side JavaScript (e.g. Node.JS). It can be integrated into any codebase; your code could use 99% standard JavaScript and a single ConstraintJS constraint.
The easiest way to get started using ConstraintJS is to download and unzip the latest package.
####Client-Side (Browser): <script src="/PATH/TO/cjs.min.js" type="text/javascript"></script>
####Server-Side (Node.JS): Use NPM to install the 'constraintjs' package:
npm install constraintjs;
Then, in your code:
var cjs = require('constraintjs');
All of ConstraintJS's functionality is accessed through the global cjs
object. cjs.noConflict()
restores the previous value of cjs
and returns the ConstraintJS object. This can be useful if there is a naming conflict.
var ConstraintJS = cjs.noConflict();
Places all of the ConstraintJS functionality into ConstraintJS
variable and resets cjs
to its previous value.