Skip to content

donavon/storeit-plugin-department

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

storeit-plugin-department Build Status

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:

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:

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:

key=mens/foo value=bar
key=foo value=bar

License

For use under MIT license

About

A StoreIt plugin that adds departments to a store.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published