All Projects → englercj → Resource Loader

englercj / Resource Loader

Licence: mit
A middleware-style generic resource loader built with web games in mind.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Resource Loader

Rext
🎈A lightweight (< 5kb gzipped) and Promise-supported HTTP request library, for all browsers.
Stars: ✭ 14 (-96.15%)
Mutual labels:  ajax, xhr
Xhr.js
🌎 xhr.js is a library(< 2Kb) to make AJAX/HTTP requests with XMLHttpRequest.
Stars: ✭ 12 (-96.7%)
Mutual labels:  ajax, xhr
Atomic
A tiny, Promise-based vanilla JS Ajax/HTTP plugin with great browser support.
Stars: ✭ 526 (+44.51%)
Mutual labels:  ajax, xhr
Thwack
A tiny modern data fetching solution
Stars: ✭ 268 (-26.37%)
Mutual labels:  ajax, xhr
http
Tiny, embeddable HTTP client with simple API for the browser
Stars: ✭ 21 (-94.23%)
Mutual labels:  xhr, ajax
Axios Tutorial
axios实例应用及源码剖析 - xhr篇 (走心教程)
Stars: ✭ 219 (-39.84%)
Mutual labels:  ajax, xhr
Ironwing
universal, framework agnostic, transport layer
Stars: ✭ 17 (-95.33%)
Mutual labels:  ajax, xhr
upload-file-to-backblaze-b2-from-browser-example
Demonstrates calling the b2_upload_file Backblaze B2 Cloud Storage API from a web browser using AJAX.
Stars: ✭ 28 (-92.31%)
Mutual labels:  xhr, ajax
angular-progress-http
[DEPRECATED] Use @angular/common/http instead
Stars: ✭ 43 (-88.19%)
Mutual labels:  xhr, ajax
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (-87.64%)
Mutual labels:  xhr, ajax
yii2-forms
Forms CRUD - formbuilder, generator code
Stars: ✭ 32 (-91.21%)
Mutual labels:  ajax
solarjs
Solar is a fast, small, and highly configurable JavaScript XHR wrapper library.
Stars: ✭ 15 (-95.88%)
Mutual labels:  xhr
Mappersmith
is a lightweight rest client for node.js and the browser
Stars: ✭ 282 (-22.53%)
Mutual labels:  ajax
Django Ajax
Fast and easy AJAX libraries for django applications. Contains ajax decorator, ajax middleware, shortcuts and more.
Stars: ✭ 312 (-14.29%)
Mutual labels:  ajax
WebStore-Spring-MVC
WebStore is a full fledged online shopping system built in Spring-MVC. It uses JSP for view templating and MySql at the database end.
Stars: ✭ 29 (-92.03%)
Mutual labels:  ajax
Reqwest
browser asynchronous http requests
Stars: ✭ 2,918 (+701.65%)
Mutual labels:  ajax
Ajax-Chat
Ajax Chat is a complete web chat in javascript, ajax, php and mysql compatible with Phonegap
Stars: ✭ 19 (-94.78%)
Mutual labels:  ajax
Ajax-CRUD-example-in-laravel
Example performing CRUD operations in laravel using ajax.
Stars: ✭ 69 (-81.04%)
Mutual labels:  ajax
PHP hotel
基于php的酒店预订信息管理系统(客房信息管理模块、客户入住管理模块、订餐信息管理模块、员工信息管理模块、最新资讯管理模块等,方便用户在线预订客房)
Stars: ✭ 41 (-88.74%)
Mutual labels:  ajax
Redux Requests
Declarative AJAX requests and automatic network state management for single-page applications
Stars: ✭ 330 (-9.34%)
Mutual labels:  ajax

Resource Loader Build Status

A generic resource loader, made with web games in mind.

Philosophy

This library was built to make it easier to load and prepare data asynchronously. The goal was mainly to unify the many different APIs browsers expose for loading data and smooth the differences between versions and vendors.

It is not a goal of this library to be a resource caching and management system, just a loader. This library is for the actual mechanism of loading data. All caching, resource management, knowing what is loaded and what isn't, deciding what to load, etc, should all exist as logic outside of this library.

As a more concrete statement, your project should have a Resource Manager that stores resources and manages data lifetime. When it decides something needs to be loaded from a remote source, only then does it create a loader and load them.

Usage

// ctor
import { Loader } from 'resource-loader';

const loader = new Loader();

loader
    // Chainable `add` to enqueue a resource
    .add(url)

    // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.
    // This is useful to implement custom parsing modules (like spritesheet parsers).
    .use((resource, next) =>
    {
        // Be sure to call next() when you have completed your middleware work.
        next();
    })

    // The `load` method loads the queue of resources, and calls the passed in callback called once all
    // resources have loaded.
    .load((loader, resources) => {
        // resources is an object where the key is the name of the resource loaded and the value is the resource object.
        // They have a couple default properties:
        // - `url`: The URL that the resource was loaded from
        // - `error`: The error that happened when trying to load (if any)
        // - `data`: The raw data that was loaded
        // also may contain other properties based on the middleware that runs.
    });

// Throughout the process multiple signals can be dispatched.
loader.onStart.add(() => {}); // Called when a resource starts loading.
loader.onError.add(() => {}); // Called when a resource fails to load.
loader.onLoad.add(() => {}); // Called when a resource successfully loads.
loader.onProgress.add(() => {}); // Called when a resource finishes loading (success or fail).
loader.onComplete.add(() => {}); // Called when all resources have finished loading.

Building

You will need to have node setup on your machine.

Then you can install dependencies and build:

npm i && npm run build

That will output the built distributables to ./dist.

Supported Browsers

  • IE 9+
  • FF 13+
  • Chrome 20+
  • Safari 6+
  • Opera 12.1+

Upgrading to v4

  • Before middleware has been removed, so no more pre function.
    • If you used pre middleware for url parsing, use the new urlResolver property instead.
  • crossOrigin must now be a string if specified.
  • Resource.LOAD_TYPE enum replaced with Load Strategies.
    • For example, loadType: Resource.LOAD_TYPE.IMAGE is now strategy: Loader.ImageLoadStrategy.
  • Resource.XHR_RESPONSE_TYPE enum replaced with XhrLoadStrategy.ResponseType.
    • For example, xhrType: Resource.XHR_RESPONSE_TYPE.DOCUMENT is now xhrType: Loader.XhrLoadStrategy.ResponseType.Document.
  • Overloads for the add function have been simplified.
    • The removed overloads were not widely used. See the docs for what is now valid.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].