Skip to content

Latest commit

 

History

History
105 lines (71 loc) · 3.02 KB

getting-started.md

File metadata and controls

105 lines (71 loc) · 3.02 KB
layout
doc-page.html

Getting Started With ally.js

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.

Downloading ally.js

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

Loading ally.js From CDN

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>

Using ally.js as <script>

<script src="path/to/ally.min.js"></script>
<script>
  console.log("loaded ally.js in version", ally.version);
</script>

Using ally.js as AMD

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

Using ally.js as CommonJS

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

Using ally.js as ES6

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