From f76dea5df4423c6ce744ac2fe4f07c53d9428b40 Mon Sep 17 00:00:00 2001 From: Yusef Sohail Date: Sun, 28 Feb 2016 19:01:42 -0600 Subject: [PATCH] minor adjustments to removing gl-matrix --- docs/cruft/net/Cache.md | 39 +++++++++++++++++++++++++++++++++++++++ docs/cruft/net/Loader.md | 0 mkdocs.yml | 3 +++ 3 files changed, 42 insertions(+) create mode 100644 docs/cruft/net/Cache.md create mode 100644 docs/cruft/net/Loader.md diff --git a/docs/cruft/net/Cache.md b/docs/cruft/net/Cache.md new file mode 100644 index 0000000..847441d --- /dev/null +++ b/docs/cruft/net/Cache.md @@ -0,0 +1,39 @@ + +[cruft/net/Cache.js](https://github.com/mjneil/CruftEngine/blob/master/cruft/net/Cache.js) +This class defines a Cache. + +## Importing +```javascript +import Cache from "cruft/net/Cache"; +``` + +##Methods + + +### register( [name](/primitives#string), [Loader](Loader.md) ) +Register Cache loader to the given name. +```javascript +import ObjLoader from "cruft/net/loaders/ObjLoader"; +cache.register("obj", new ObjLoader()); +cache.get("obj!assets/models/CruftModel.obj").then((asset) => { + //asset is the parsed obj model +}); +``` + +### get( [path](/primitives.md#string) ) +Path to the asset to load. Optionaly prefixed with pluginname! to specify which loader to use. +```javascript +cache.get("json!assets/data/data.json").then((data) => { + console.log(data.pasword)//data is an obect. +}); +``` + + +### load( ...[paths](/primitives.md#string) ) +load all of the specified paths. + +```javascript +cache.load("json!assets/data/data.json", "json!assets/data/data2.json").then((paths) => { + console.log(paths["json!assets/data.txt"]); // contents of data.json +}) +``` \ No newline at end of file diff --git a/docs/cruft/net/Loader.md b/docs/cruft/net/Loader.md new file mode 100644 index 0000000..e69de29 diff --git a/mkdocs.yml b/mkdocs.yml index 218355b..5d5dfa5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -13,6 +13,9 @@ pages: - ActorFactory : 'cruft/core/ActorFactory.md' - Scheduler : 'cruft/core/Scheduler.md' - Emitter : 'cruft/core/Emitter.md' +- Net : + - Cache : 'cruft/net/Cache.md' + - Loader : 'cruft/net/Loader.md' - Math : - vec2 : 'cruft/math/vec2.md' - vec3 : 'cruft/math/vec3.md'