ITSA modules are CommonJS-modules which can be used in nodejs
or on the browser
. In both cases, you reference them with require(
'modulename')
.
Your project will have these three elements:
package.json
, or start with our distribution package.json. It is important that every require() you use inside your scriptfile has its dependency defined inside package.json. Once you have set package.json up, you run npm install
which will create node_modules and all the required packages.
From there, you can start writing your scriptfile, which probably looks something like this:
ITSA
is a namespace to 'itsa', which we created inside our package.json distribution. It has all ITSA's modules in the namespace. They are available like: ITSA.Event
and ITSA.IO
, see the moduledocumentation how to use these modules.
package.json
-files, you might want to customize and choose only those modules you need. Read more about it at ITSA customized build.
Because the browser doesn't support "require()
", you need to bundled loader-file (bundled with Browerify). Browserify inspects your code and creates a single bundle-file that holds all the requirements (and its dependencies) and will define the require()-method in the browser.
The easiest way is to use our predefined loaderfiles. You can choose either to use the minified version itsabuild-min.js
(advisable) or the full-version itsabuild.js
for debugging.
The build-file should be included by a script tag at the bottom of the document, just above </body>
. Followed by your code, which is within a <script>
-tag itself:
<script src="/itsabuild-min.js"></script>
ITSA
is a namespace to 'itsa', which we created inside our package.json distribution. It has all ITSA's modules in the namespace. They are available like: ITSA.Event
and ITSA.IO
, see the moduledocumentation how to use these modules.
ITSA
, you might want to customize the build-files yourself.