rmem.js 455 B

12345678910111213141516171819202122
  1. function Rmem(){
  2. var opt = {}, store = {}, u;
  3. opt.put = function(file, data, cb){
  4. //setTimeout(function(){ // make async
  5. store[file] = data;
  6. cb(null, 1);
  7. //}, 1);
  8. };
  9. opt.get = function(file, cb){
  10. //setTimeout(function(){ // make async
  11. var tmp = store[file] || u;
  12. cb(null, tmp);
  13. //}, 1);
  14. };
  15. return opt;
  16. }
  17. if(typeof window !== "undefined"){
  18. window.Rmem = Rmem;
  19. } else {
  20. try{ module.exports = Rmem }catch(e){}
  21. }