-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor adjustments to removing gl-matrix
- Loading branch information
1 parent
c17bb14
commit f76dea5
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters