Coder Social home page Coder Social logo

aftc.preload.js's Introduction

AFTC.Preload

Donate

ES5 Version

Click on the "js" folder above. https://github.com/DarceyLloyd/AFTC.Preload.js/tree/master/js

<script src="./js/dist/aftc.preload.min.js"></script>

JS Modules usage

Click on the "jsm" folder above. https://github.com/DarceyLloyd/AFTC.Preload.js/tree/master/jsm

import { AFTCPreloader } from "./jsm/aftc.preloader.js";

Install

npm i -S aftc.preload

Usage

// Instantiate and set onProgress and onComplete callback function handlers
let preloader = new AFTCPreloader({
    onProgressHandler: onProgressHandler,
    onCompleteHandler: onCompleteHandler
});

// preloader.help(); // Shows some help info

// Load JSON list of files into the preload and start preloading
preloader.start("./preloader.json");

function onProgressHandler(p,file) {
    // NOTE setHTML is from library aftc.js (ES5) / aftc-modules (JSM)

    // Sets html element with id "status" to "Loading"
    setHTML("status","Loading");

    // Sets html element with id "percent" to the percentage loaded 
    setHTML("percent",p + "%"); 

    // Prepends files loaded to html element with id "files"
    setHTML("files",file,"prepend");
}

function onCompleteHandler() {
    // NOTE setHTML is from library aftc.js (ES5) / aftc-modules (JSM)

    // Sets html element with id "status" to "Loaded"
    setHTML("status","Loaded");
}

It is recommend that you use the JSM version

https://github.com/DarceyLloyd/AFTC.Preload.js/tree/master/jsm

aftc.preload.js's People

Contributors

darceylloyd avatar

Stargazers

Joseph Evans avatar  avatar Alex Viscreanu avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.