{"_id":"resl","_rev":"7-5b422c85419d47373bb515a2547719b0","name":"resl","description":"A streaming resource loader","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"resl","version":"1.0.0","description":"A streaming resource loader","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/resl.git"},"keywords":["resource","asset","loader","preloader","load","preload","webgl","stackgl","regl"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/resl/issues"},"homepage":"https://github.com/mikolalysenko/resl#readme","gitHead":"d071a555bf79453c0dadb10e93f13d3f82065734","_id":"resl@1.0.0","_shasum":"0ec59ebc22892c6d93799f60ceda1519ef5744aa","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"0ec59ebc22892c6d93799f60ceda1519ef5744aa","tarball":"https://registry.npmjs.org/resl/-/resl-1.0.0.tgz","integrity":"sha512-i2zSlHthQU8ACgR2ugjTrX2zoF0VjXkzqFAs8r0WBqDHYmXXa8BrMtJyjnCItaQao1fm/RCPMn+3ookRizMp9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAq+SmgF8+mgQCl/1poi+Sp50SEFWnLue5l3LjzT9OxAIhAL+8AwvZzCZhnXO/wCPSfsapXNkifP913P/y0s0LXGVY"}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resl-1.0.0.tgz_1466656998266_0.635129195638001"}},"1.0.1":{"name":"resl","version":"1.0.1","description":"A streaming resource loader","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/resl.git"},"keywords":["resource","asset","loader","preloader","load","preload","webgl","stackgl","regl"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/resl/issues"},"homepage":"https://github.com/mikolalysenko/resl#readme","gitHead":"f68b44a960c81332717b06b4793b45935186ab1d","_id":"resl@1.0.1","_shasum":"ae30a0c820e8615378b79251554cafbe532255bb","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"ae30a0c820e8615378b79251554cafbe532255bb","tarball":"https://registry.npmjs.org/resl/-/resl-1.0.1.tgz","integrity":"sha512-p6yLp0+gpvklfR8PwO84oIfKOVsz63cwvLPXKJJLNVL8zQe7CvHoGOqbVbNUlrjiYdFECDDwCfw8jIyCCG65FA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDbwUqJWBh/UDPUJDeUaLNPZjoq0wT1Jkc0s+U2dJv4KAiEAmLDH0LGCzRKfGFCK4ia+JPr6VVNExlMziYMXmmIwZ7g="}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resl-1.0.1.tgz_1466698210829_0.17760511860251427"}},"1.0.2":{"name":"resl","version":"1.0.2","description":"A streaming resource loader","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/resl.git"},"keywords":["resource","asset","loader","preloader","load","preload","webgl","stackgl","regl"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/resl/issues"},"homepage":"https://github.com/mikolalysenko/resl#readme","gitHead":"e9e270ae09e71684426af63a0f50538db85a70ba","_id":"resl@1.0.2","_shasum":"69559c542ce5a8bca2a29d8c5ad40d7019b72dac","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"69559c542ce5a8bca2a29d8c5ad40d7019b72dac","tarball":"https://registry.npmjs.org/resl/-/resl-1.0.2.tgz","integrity":"sha512-xi1g4RqOmTF435D3V9qQ/d8OUl27BrPMCzi8tQmb5hn6FfZSXFK0qz76wij46I5NeriLN6LjJ2Vhq1/yQRPv3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3B9FFD9Z3UVJ5e+YtYXP9c1aFOZTuBdgTANeVlTuUGwIhAKe08gtg7xeEuARJ/pnkNk+Jo+JQaQN6QNGPC2bNERG5"}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/resl-1.0.2.tgz_1470443949881_0.4310550596565008"}},"1.0.3":{"name":"resl","version":"1.0.3","description":"A streaming resource loader","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/resl.git"},"keywords":["resource","asset","loader","preloader","load","preload","webgl","stackgl","regl"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/resl/issues"},"homepage":"https://github.com/mikolalysenko/resl#readme","gitHead":"954547390fdae89588b083e1388176959b4f9d05","_id":"resl@1.0.3","_shasum":"2c7ca5682285bc519f7dcfb81fe6f3df0005e774","_from":".","_npmVersion":"2.13.1","_nodeVersion":"0.12.2","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"2c7ca5682285bc519f7dcfb81fe6f3df0005e774","tarball":"https://registry.npmjs.org/resl/-/resl-1.0.3.tgz","integrity":"sha512-8Z+92d1TJjGIko9+YL/GTg3sZT1n07+rjHJuQgBH4y57vyDRgtnUzubhaI21mOz3zCvz10Hbv3xAAyAVyPrUOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEVXDLThSbLmgvh8iBsu3h+9ZEbPOCvCccdMQvudvkVwAiEAgNv8VSXT4yp3yaexMX4iMhfqxqs/wtKf7H2LVtSg7fQ="}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resl-1.0.3.tgz_1472087346617_0.0016855844296514988"}}},"readme":"resl\n====\n`resl` (RESource Loader) is a tiny streaming asset loader intended for use with WebGL applications.\n\n# Example\n\n```javascript\n// Here we call resl and tell it to start preloading resources\nrequire('resl')({\n  // A call to resl takes a JSON object as configuration.\n\n  // The configuration object must contain a manifest field which specifies\n  // a list of all resources to load and their types.\n  manifest: {\n    // Each entry in the manifest represents an asset to be loaded\n    'scores': {\n      type: 'text',           // the type declares the type of the asset\n      src: 'data/scores.csv'  // and src declares the URL of the asset\n    },\n\n    // You can also specify HTML elements as assets\n    'an_image': {\n      type: 'image',\n      src: 'images/some-image.png'\n    },\n\n    // Assets can also be streamed as well\n    'some_video': {\n      type: 'video',\n      stream: true,   // setting the streaming flag specifies that\n                      // the done() callback will fire as soon as the\n                      // asset has started loading\n      src: 'videos/some-video.mp4'\n    },\n\n    // You can also specify custom parsers for your assets\n    'json_data': {\n      type: 'text',\n      src: 'mydata.json',\n      parser: JSON.parse  // Here we call JSON.parse as soon as the asset has\n                          // finished loading\n    }\n  },\n\n  // Once the assets are done loading, then we can use them within our\n  // application\n  onDone: (assets) => {\n    console.log(assets.scores)\n\n    document.body.appendChild(assets.some_video)\n    document.body.appendChild(assets.an_image)\n\n    console.log(assets.json_data)\n  },\n\n  // As assets are preloaded the progress callback gets fired\n  onProgress: (progress, message) => {\n    document.body.innerHTML =\n      '<b>' + (progress * 100) + '% loaded</b>: ' + message\n  },\n\n  onError: (err) => {\n    console.error(err)\n  }\n})\n```\n\n# Install\nThe easiest way to install `resl` is to use npm:\n\n```\nnpm install resl\n```\n\n# API\n\n### `require('resl')(config)`\n`resl` takes a single configuration object as input.  At minimum this object must specify a callback which is executed once asset loading is finished and a manifest of assets which must be loaded.  The `config` object accepts the following properties:\n\n| Config parameter | Interpretation |\n|------------------|----------------|\n| `manifest` | (Required) An object listing each resource to be loaded. [For more details see below](#manifest-entries) |\n| `onDone(assets)` | (Required) A callback which is executed once all assets have loaded.  This is passed a dictionary of all assets. |\n| `onProgress(progress, message)` | A callback which is executed each time more assets are loaded.  Gets passed two arguments: progress so far as a fraction of the total bundle and a message related to the most recent progress event. |\n| `onError(error)` | A callback which is executed if any errors are encountered during preloading.  Gets passed the last error which occurred. |\n\n#### Manifest Entries\nEach entry in the manifest is an object specifying the location (URL) of an asset, its type and some optional data related to parsing the asset.  User defined [parsers](#parser-interface) can be added to assets to help streamline loading resources.  \n\n| Manifest parameter | Interpretation | Default |\n|--------------------|----------------|---------|\n| `src` | (Required) The URL of the asset | N/A |\n| `type` | The [type of the asset](#resource-types). | `'text'` |\n| `parser` | An optional [parser](#parser-interface) (see below) | `null` |\n| `stream` | If set to true, then the resource is streamed. | `false` |\n| `credentials` | If set to true, then pass credentials to cross origin requests | `false` |\n\n#### Resource types\nThe following resource types are currently supported by `resl`:\n\n| Resource type | Interpretation |\n|---------------|----------------|\n| `'text'` | A UTF string loaded via XHR |\n| `'binary'` | Binary array buffer loaded via XHR |\n| `'image'` | An [HTML image element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) |\n| `'video'` | An [HTML video element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) |\n| `'audio'` | [An HTML audio element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio) |\n\n#### Parser interface\nA manifest entry may take an optional parser object as input which transforms the base asset into some other data type.  There are two ways to specify a parser in `resl`:\n\n1. As a function `parser(data)` which takes as input the data and returns the encoded object.\n1. As an object which implements the following interface:\n\n| Callback | Effect |\n|----------|--------|\n| `onData(data)` | (Required) A callback which is fired each time new data is available in the stream |\n| `onDone()` | A callback which is fired once the stream is finished loading |\n\n# License\n(c) 2016 Mikola Lysenko. MIT License\n","maintainers":[{"name":"erkaman","email":"arnebackeric@gmail.com"},{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2022-06-26T11:51:07.232Z","created":"2016-06-23T04:43:18.734Z","1.0.0":"2016-06-23T04:43:18.734Z","1.0.1":"2016-06-23T16:10:11.319Z","1.0.2":"2016-08-06T00:39:11.763Z","1.0.3":"2016-08-25T01:09:08.214Z"},"homepage":"https://github.com/mikolalysenko/resl#readme","keywords":["resource","asset","loader","preloader","load","preload","webgl","stackgl","regl"],"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/resl.git"},"author":{"name":"Mikola Lysenko"},"bugs":{"url":"https://github.com/mikolalysenko/resl/issues"},"license":"MIT","readmeFilename":"README.md"}