« Back
Sammy.Store fetch ( key, callback )
Returns the value at key if set, otherwise, runs the callback
and sets the value to the value returned in the callback.
Example
var store = new Sammy.Store;
store.exists('foo'); //=> false
store.fetch('foo', function() {
return 'bar!';
}); //=> 'bar!'
store.get('foo') //=> 'bar!'
store.fetch('foo', function() {
return 'baz!';
}); //=> 'bar!
comments powered by Disqus