Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpogue/keyedobject.js
A Keyed-Object, Resource Manager, and Factory implementation in JavaScript.
https://github.com/dpogue/keyedobject.js
Last synced: 13 days ago
JSON representation
A Keyed-Object, Resource Manager, and Factory implementation in JavaScript.
- Host: GitHub
- URL: https://github.com/dpogue/keyedobject.js
- Owner: dpogue
- License: mit
- Created: 2011-07-16T21:42:28.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-07-18T02:58:24.000Z (over 13 years ago)
- Last Synced: 2024-11-08T09:45:57.427Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
KeyedObject.js
==============
A Keyed-Object, Resource Manager, and Factory implementation for JavaScript.
This project aims to be usable both in-browser as well as through Node.js.In-Browser
----------
The include order is important when being used in a browser:```html
```
Future plan is to have a script that will either load these dynamically, or concatenate and minify them.
Node.js
-------
With Node, you'll need to include all of your class definitions.
To actually use the majority of the functionality, you only need to store the global resource manager:```javascript
/* Require classes here:
require('./example/person.js');
*/
gResMgr = require('./resmgr.js').gResMgr;
// Your loading code here
```Example Usage
=============
```javascript
var myobj = '{"key": {"type": 0, "index": 0}, "name": "John Doe"}';
var obj = gResMgr.read(JSON.parse(myobj));var k = new Key();
k.read({type: 0, index: 0});
var o2 = gResMgr.find(k);console.log("Same object? " + (obj == o2));
```