Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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));
```