https://github.com/donavon/storeit-plugin-department
A StoreIt plugin that adds departments to a store.
https://github.com/donavon/storeit-plugin-department
Last synced: 8 months ago
JSON representation
A StoreIt plugin that adds departments to a store.
- Host: GitHub
- URL: https://github.com/donavon/storeit-plugin-department
- Owner: donavon
- License: mit
- Created: 2015-01-08T01:23:17.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-08T21:49:31.000Z (almost 11 years ago)
- Last Synced: 2025-02-23T15:06:09.580Z (8 months ago)
- Language: CoffeeScript
- Size: 246 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
storeit-plugin-department [](https://travis-ci.org/YuzuJS/storeit-plugin-department)
=======
A StoreIt plugin that adds departments to a store.It adds a `store.createDepartment("name")` method and returns an instance of `Department`.
A `department` is basically same as a store but limited in scope.## Use the Plugin
Before you can use the `storeit-plugin-department` plugin, you must install it into StoreIt as follows:
```javascript
var Storeit = require("storeit");
var departmentPlugin = require("storeit-plugin-department");
Storeit.use(departmentPlugin);
```
## Example
Here is an example of what you can do with departments:
```javascript
var store = new Storeit("my-store", provider);
var mensDepartment = store.createDepartment("mens");
var womensDepartment = store.createDepartment("womens");function logit(value, key) {
console.log("key=%s value=%s", key, value);
}store.on("added", logit);
mensDepartment.on("added", logit);
womensDepartment.on("added", logit);mensDepartment.set("foo", "bar");
```The output would be:
```shell
key=mens/foo value=bar
key=foo value=bar
```## License
For use under [MIT license](http://github.com/YuzuJS/storeit-plugin-department/raw/master/LICENSE)