Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Using ConstraintJS

Stephen Oney edited this page Dec 29, 2013 · 8 revisions

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');

The cjs object

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.


Next: Constraint Variables

Previous: Introduction

Clone this wiki locally