PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.

Overview
PxLoader is a Javascript library that helps you download images, sound files or anything else you need before you take a specific action on your site (like showing a user interface or starting a game). You can use it to create a preloader for HTML5 games and websites.

Details and examples:
http://thinkpixellab.com/pxloader/

The MIT License

Copyright (c) 2012 Pixel Lab

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Comments
  • Plugin improvements

    Plugin improvements

    Various plugin improvements:

    • Enable setting responseType for PxLoaderData's internal XHR to allow requests for data other than plain-text (e.g. Blob data)
    • Fixed PxLoaderData triggering load handler with partial data for large requests
    • Release HTTP connections used by PxLoaderAudio and PxLoaderVideo after loading is completed, closes #53
    • Normalized plugin APIs: replaced origin parameter used by PxLoaderAudio, PxLoaderImage and PxLoaderVideo with options hash for all plugins
    • Refactored PxLoaderAudio, PxLoaderImage and PxLoaderVideo to reduce code duplication
    opened by robinnorth 4
  • CommonJS support

    CommonJS support

    The way exports are defined in PxLoader are incompatible with CommonJS. The PxLoader script becomes un-scoped from the window, so exporting to this is useless.

    CommonJS support can be added with this line: if(module && module.exports) module.exports = PxLoader;

    opened by positlabs 4
  • PxLoaderImage throws exception when options is undefined

    PxLoaderImage throws exception when options is undefined

    This code used to work:

    pxImage = new PxLoaderImage(src);
    

    It now throws an exception as of version 1.1.1:

    PxLoaderImage.js:24 Uncaught TypeError: Cannot read property 'origin' of undefined
    

    A workaround is to pass in an empty options object:

    pxImage = new PxLoaderImage(src, undefined, undefined, {});
    
    opened by srveit 3
  • GIF images skipping to end on IE

    GIF images skipping to end on IE

    For some reason, in IE, after pre loading an animated gif and placing it on the page, the animation is on the last frame (for non-looping gifs). Examlpe of issue: http://jsfiddle.net/xJveS/4/

    opened by deathau 3
  • Full preload video

    Full preload video

    I have to load a lot of videos. PXLoader could help me do that. For now, video continues to load but the addCompletionListener() function is already running. While reading, I realized that this is the browser that managed if the video could be played. But I 'd like the video is fully charged for not having buffering after the loader.

    Is it possible to force the full load media ? Thank you

    opened by kevingobert 2
  • PxLoader on NPM

    PxLoader on NPM

    Hi!

    I really like PxLoader and I use it on every project I do. But I would like to install the library with NPM instead of Bower. Is it possible to do this ? :)

    opened by vdaguenet 2
  • Add Bower

    Add Bower

    I'm adding this library to the bower registry under my user/repo, I'll gladly remove it once this has been merged and we can add it again under the Pixel Lab account.

    fixes #30

    opened by mrpollo 2
  • AMD support

    AMD support

    Even tough there seems to be some work done for providing AMD compatibility, there are some inconsistencies that may still fail.

    For example, I can have:

    define [
      'pxloader'
      'pxloaderimage'
      'pxloadersound',
      'pxloadervideo'
    ], ( pxloader, pxloadersound, pxloaderimage,  pxloadervideo)->
        # code here...
    

    Which may fail, since PxLoaderimage, PxLoaderSound and PxLoaderVideo will try to add some methods on PxLoader prototype through it's global definition.

    PxLoader.prototype.addVideo = function(url, tags, priority) {
    PxLoader.prototype.addSound = function(id, url, tags, priority) {
    PxLoader.prototype.addImage = function(url, tags, priority) {
    

    As AMD do not load files orderly, the sound, image and video plugins may finish loading first, specially because they are much smaller. And every time it happens, an error will be raised.

    Uncaught ReferenceError: PxLoader is not defined 
    

    In order to fix this, this raw prototype calls should be made as a AMD require as well in case define and amd.define is present, so the PxLoader reference will never be undefined.

    opened by arboleya 2
  • addCompletionListener callback parameter

    addCompletionListener callback parameter

    The documentation shows callbacks supplied to addCompletionListener get called with an event parameter, but it appears they don't. It would actually be useful if they did.

    opened by sprintstar 2
  • images do not download in order specified by tags

    images do not download in order specified by tags

    I have the following:

        loader = new PxLoader();
    
        //title page
        for(var i=0; i<titlePageImages.length; i++)
        {
            pxImage = new PxLoaderImage(titlePageImages[i], "titlePage");
            pxImage.imageNumber = i + 1;
            loader.add(pxImage);
    
        }
    
        loader.addProgressListener(function(e) { 
            console.log("titlePage: " + e.completedCount + ' / ' + e.totalCount); 
    
        }, "titlePage");
    
        loader.addCompletionListener(function(e) { 
            console.log('Title Page Loaded'); 
        }, "titlePage");
    
        //main
        for(i=0; i<mainImages.length; i++)
        {
            pxImage = new PxLoaderImage(mainImages[i], "main");
            pxImage.imageNumber = i + 1;
            loader.add(pxImage);
    
    
        }
    
        loader.addProgressListener(function(e) { 
            console.log("main: " + e.completedCount + ' / ' + e.totalCount); 
    
        }, "main");
    
    
        loader.addCompletionListener(function(e) { 
            console.log('Main Assets Loaded'); 
        }, "main");
    
        loader.start(["titlePage", "main"]);
    

    And I am getting this output in the console:

    titlePage: 1 / 7
    titlePage: 2 / 7
    titlePage: 3 / 7
    titlePage: 4 / 7
    main: 1 / 17
    main: 2 / 17
    main: 3 / 17
    main: 4 / 17
    main: 5 / 17
    titlePage: 5 / 7
    main: 6 / 17
    main: 7 / 17
    main: 8 / 17
    main: 9 / 17
    main: 10 / 17
    main: 11 / 17
    main: 12 / 17
    main: 13 / 17
    main: 14 / 17
    main: 15 / 17
    titlePage: 6 / 7
    main: 16 / 17
    titlePage: 7 / 7
    Title Page Loaded
    main: 17 / 17
    Main Assets Loaded
    

    As you can see the elements tagged with "main" start downloading before the "titlePage" elements have completed.

    opened by neoshamangames 1
  • Cannot read property 'origin' of undefined

    Cannot read property 'origin' of undefined

    PxLoaderImage.js is causing an error due to these lines of code:

    if (options.origin) {
       img.crossOrigin = options.origin;
    }
    

    This is how I'm defining the loader:

    loader = new PxLoader();
    loader.add(new PxLoaderImage('images/arrow-bottom.jpg'));
    

    A user reported this and then closed the topic, saying he solved it by "passing in all the args", but he didn't post his code solution. I don't know what arguments the loader needs. Help?

    And since I have the topic open, one more question: when you say PxLoaderSound.js "works with SoundManager 2", does that mean I need to download that API? What order should I load it in (before or after the px files)?

    opened by gem0303 1
  • Advice on how to write a plugin for inline or async data operations (e.g. promises)

    Advice on how to write a plugin for inline or async data operations (e.g. promises)

    Hi, have been using this library for years - thanks for the efforts on this. I've been mulling over whether it's possible for a plugin to handle asynchronous/promise operations? A couple of use cases:

    • ~~I'm pulling data asynchronously from a remote api, I want pxloader to wait for the data to come in~~. I just saw that there is a PxLoaderData plugin for this use case.
    • I'm running internal data handling logic that involves the use of a promise. I want pxloader to wait for the promise to resolve.

    I took a quick look at some of the existing plugins but didn't have time to dig into them. I imagine others must have this same use case in their apps. So my question at this point is, what is the best approach here: write a custom plugin that ties all of this into pxloader or handle these types of async/promise operations outside of pxloader?

    If it's the latter, the issue is then how to seamlessly integrate into pxloader's progress/complete logic and handlers?

    Thanks in advance for any guidance/info on this.

    opened by droplab 1
  • RequireJS issue v1.1.0

    RequireJS issue v1.1.0

    Starting with v1.1.0 of PxLoader, I am now getting the following error when including it in my code.

    require.js:168 Uncaught Error: Script error for "pxloader", needed by: app/Sounds, utils/resizer

    Neither of the scripts listed use PxLoader in anyway, so I am a little confused by the error.

    I have a path set to point to pxloader's folder in my requirejs config.

    paths: { jquery: '../bower_components/jquery/dist/jquery.min', greensock: '../bower_components/greensock/src/minified', pxloader: '../bower_components/PxLoader/dist' },

    And in the file that produces the error....

    if (typeof define === 'function' && define.amd) { define( [ 'jquery', 'pxloader/pxloader-all' ], function () {...

    PxLoader 1.0.2 and backwards work ok. This error is new to 1.1.0.

    Anyone suggestions of how to resolve it would be appreciated.

    opened by genericandy 2
  • gulping with babel produces errors

    gulping with babel produces errors

    Not sure if this has been addressed already but when I gulp pxloader.js with babel .pipe($.babel()) it returns a couple "PxLoader is not defined" errors.

    opened by pjldesign 1
  • Numbers should not jump in

    Numbers should not jump in "addProgressListener ". For eg. - 10, 11, 12, 13 ... instead of 10, 12, 15, 20.

    hello! Great plugin, have been using the same for couple of my websites.

    Our client has a requirement that can we have the plugin output the numbers in "addProgressListener " in a smooth transition For example - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ... instead of 10, 12, 15, 20.

    Not sure if its possible with adding a variable and using setTimeout,etc. But that would be too complicated.

    Thanks.

    opened by prashantsani 1
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
MLPleaseHelp is a simple ML resource search engine.

README MLPleaseHelp is a simple ML resource search engine. How To Use You can use this search engine right now at https://jgreenemi.github.io/MLPlease

Joseph Greene 5 Jan 20, 2021
JS Cloudimage 360 View - A simple, interactive resource that can be used to provide a virtual tour of your product

JS Cloudimage 360 View - A simple, interactive resource that can be used to provide a virtual tour of your product

Scaleflex 1.9k Jan 7, 2023
Palaemon is an open-source developer tool for monitoring health and resource metrics of Kubernetes clusters and analyzing Out of Memory (OOMKill) errors

Palaemon ?? ?? An Electron based developer tool for Kubernetes cluster monitoring and error analysis Palaemon is a Greek, child sea-god who came to ai

OSLabs Beta 99 Dec 28, 2022
A new Node.js resource built using Gatsby.js with React.js, TypeScript, and Remark.

Nodejs.dev Nodejs.dev site built using Gatsby.js with React.js, TypeScript, SCSS, and Remark. You can find the latest Figma design protype here. ?? Ge

Node.js 2.2k Jan 5, 2023
This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs into account to help you efficiently design your facilities.

Foxhole Facility Planner This tool allows you to draw up plans for facilities from Foxhole's new Inferno update. It takes power and resource needs int

Brandon Ray 23 Dec 23, 2022
Utility for collecting resource-based policies from an AWS account

AWS resource-based policy collector This library aims to collect resource-based policies from an AWS account. NOTE: This library does not cover all AW

Will Dady 22 Dec 5, 2022
Cache Solidjs resources by key (derived from the resource source)

Solid Cached Resource (Experimental) Create a solid resource attached to a cached state by a unique key. Heavily inspired by react-query, but for soli

Yonatan 27 Dec 31, 2022
Sanity plugin for viewing resources which reference a particular resource.

@indent-oss/sanityio-referenced-by Plugin to see which documents reference a particular document referenced-by-sanityio.mov Video Alt Text: Demonstrat

Indent 16 Nov 2, 2022
This document introduces an early implementation of the Node-RED runtime that runs on resource-constrained microcontrollers (MCUs).

Node-RED MCU Edition Copyright 2022, Moddable Tech, Inc. All rights reserved. Peter Hoddie Updated June 25, 2022 Introduction This document introduces

Peter Hoddie 53 Jan 3, 2023
Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome.

Flatline Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome. Load the extension in Firefox Clone the repository Open

Cleo Menezes Jr. 43 Nov 7, 2022
Sample apps showing how to build music and video apps for Xbox using a WebView.

description languages name page_type products urlFragment Sample showing how to build music and video apps using primarily web technologies for Xbox.

Microsoft 11 Dec 14, 2022
why make apps to increase focus -- when you can make apps to reduce focus

impossifocus ?? What is this? ImpossiFocus will measure focus by reading your brainwaves -- and if you're in the zone, it'll ensure that changes with

Aleem Rehmtulla 10 Nov 30, 2022
Simple format that serves it's one and only purpose and that's creating simple task list everywhere where you can write plain text

SWTF (Simple Worklog Task Format) Simple format that serves it's one and only purpose and that's creating simple task list everywhere where you can wr

null 4 Apr 4, 2022
In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaScript index file that imported all the modules and assets

To Do List In this project, I built a simple HTML list of To-Do tasks. This simple web page was built using Webpack, creating everything from a JavaSc

Andrés Felipe Arroyave Naranjo 10 Mar 31, 2022
A simple, lightweight, clean and small library for creating guided product tours for your web app.

Tourguide.js Simple, lightweight library for creating guided tours for your web, apps and more. A tour guide is a person who provides assistance, info

Docsie.io 277 Dec 12, 2022
A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses

MeiMei - Multiple Email Input MeiMei: A simple easy to use vanilla JavaScript library for creating input fields that accept multiple email addresses.

Lars Straathof 1 Apr 13, 2022
Simple To-do list build using HTML5, CSS3, JavaScript and Webpack. You can add new tasks, remove and edit them.

Simple To-do list build using HTML5, CSS3, JavaScript and Webpack. You can add new tasks, remove and edit them.

Esteban Munoz 6 Mar 5, 2022