Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/model-memoize
Memoizes the model objects returned from the server to reduce outbound requests and speed up initial page loading.
https://github.com/segment-boneyard/model-memoize
Last synced: about 7 hours ago
JSON representation
Memoizes the model objects returned from the server to reduce outbound requests and speed up initial page loading.
- Host: GitHub
- URL: https://github.com/segment-boneyard/model-memoize
- Owner: segment-boneyard
- Created: 2013-06-24T20:57:03.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-22T06:24:23.000Z (about 11 years ago)
- Last Synced: 2024-04-09T16:31:12.497Z (7 months ago)
- Language: JavaScript
- Size: 130 KB
- Stars: 6
- Watchers: 38
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# model-memoize
Memoizes the model objects returned from the server to reduce outbound requests and speed up initial page loading.
## Installation
$ component install segmentio/model-memoize
## Examples
Just `use` the plugin:
```js
var memoize = require('model-memoize');
var model = require('model');var Person = model('person')
.use(memoize)
.attr('id')
.attr('name');
```You can also pass in an array of models to be memoized from the beginning, which is useful for passing in models served from the server on initial page load:
```js
var Person = model('person')
.attr('id')
.attr('name')
.use(memoize(window.people)); // array of `person` objects
```If you're passing in an array, make sure to define your Model's attributes first.
## License
MIT