protoscop
v0.0.0
Published
Prototype-based context handling
Downloads
5
Readme
proto-context
Manage context with ease
Usage
var Context = require('proto-context');
var ctx = {};
ctx.value = 'first version'; // console.log(ctx.value) -> 'first version'
ctx = Context.snapshot(ctx);
ctx.value = 'second version'; // console.log(ctx.value) -> 'second version'
ctx = Context.restore(ctx);
console.log(ctx.value); // -> 'first version'
API
Context.snapshot(ctx)
Creates new Object and add it to ctx
prototype.
Context.restore(ctx)
Removes created Object from prototype chain of ctx.