layout |
---|
doc-page.html |
ally.js is a JavaScript library simplifying certain accessibility features, functions and behaviors. However, simply loading ally.js will not automagically make a web application accessible. The library provides certain standard functions the "web platform" should've provided itself, so JavaScript applications be made accessible more easily. This document covers how to import ally.js in your project - see the API Documentation to learn what the library actually provides.
You can download the production file ally.min.js
(and ally.min.js.map
if you want Source Maps support) from the github release page, or install it using npm:
npm install ally.js --save
FIXME: CDNjs support is not yet available
ally.js is made available for production use by cdnjs:
<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.0.0-beta.6/ally.min.js"></script>
<script>
console.log("loaded ally.js in version", ally.version);
</script>
<script src="path/to/ally.min.js"></script>
<script>
console.log("loaded ally.js in version", ally.version);
</script>
The production bundle contains all dependencies, allowing you to require ally.js directly:
require(['ally.js'], function(ally) {
console.log("loaded ally.js in version", ally.version);
});
Alternatively you can use only specific modules provided by ally.js, but need to take care of mapping dependencies first:
require.config({
paths: {
// map to AMD files
'ally': 'node_modules/ally.js/dist/amd',
// provide paths to dependencies
'array.prototype.findindex': 'node_modules/array.prototype.findindex/index',
'css.escape': 'node_modules/css.escape/css.escape',
'platform': 'node_modules/platform/platform',
}
});
Now you can import specific modules using
require(['ally/version'], function(allyVersion) {
console.log("loaded version of ally.js", allyVersion);
});
The production bundle contains all dependencies, allowing you to require ally.js directly:
var ally = require('ally.js');
console.log("loaded ally.js in version", ally.version);
Alternatively you can use only specific modules provided by ally.js:
var allyVersion = require('ally.js/dist/common/version');
console.log("loaded version of ally.js", allyVersion);
ally.js is authored in ES6 and its modules are accessible in the src
directory:
import allyVersion from 'ally.js/src/version';
console.log("loaded version of ally.js", allyVersion);
Continue with checking out one of the Tutorials or head on to the API Documentation