Skip to content

Importing

Johan Fagerberg edited this page Aug 5, 2018 · 4 revisions

FlippyJS is a UMD module, which can be imported in AMD or CommonJS, or by simply including it as a <script>.
Two things are exported:

  1. flip(...) - the main function, as described in Usage
  2. FLIPElement - the internal class used to represent animated elements, as described in Advanced Usage

AMD

define(["flippy.js"], (flip)=>{
    const FLIPElement = flip.FLIPElement;
});

CommonJS

const flip = require("flippy.js");
const FLIPElement = require("flippy.js").FLIPElement;

<script>

// flip is already defined as a global
const FLIPElement = flip.FLIPElement.
Clone this wiki locally