Skip to content
hhh edited this page Jul 3, 2020 · 11 revisions

Documentation for super-x

Here is the documentation for super-x.

TOC

Usage

npm

  1. Use npm to install it as a dependency:

    npm install super-x
  2. Import the exports of this lib:

    import { /* ... */ } from "super-x";
    // or
    const { /* ... */ } = require("super-x");
  3. Use them in your code.

CDN

  1. Include one of the following script tags in your HTML file:

    via jsdelivr:

    <script type="text/javascript" crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/super-x@latest/dist/super-x.umd.min.js"></script>

    or via unpkg:

    <script type="text/javascript" crossorigin="anonymous" src="https://unpkg.com/super-x@latest/dist/super-x.umd.min.js"></script>
  2. Access the APIs via the X global.

    const { /* ... */ } = X;

If you want a specified version, just replace latest with that in the url. By the way, it is recommended to use a specified version in production.

For more information about these two CDN sites, visit www.jsdelivr.com and unpkg.com.

Environment Requirements

super-x depends on some features like Map and requestAnimationFrame. Therefore, if you want to use super-x in some older environments that don't support them, remember to include a polyfill lib to fix them.

For instance, include hpolyfill by putting one of the following script tags in your HTML: (It should be loaded before other scripts.)

<!-- via jsdelivr: -->
<script type="text/javascript" crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/hpolyfill@latest/dist/index.js"></script>
<!-- or via unpkg: -->
<script type="text/javascript" crossorigin="anonymous" src="https://unpkg.com/hpolyfill@latest/dist/index.js"></script>

Getting Started

Clone this wiki locally