Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 570 Bytes

Readme.md

File metadata and controls

33 lines (23 loc) · 570 Bytes

A auto-reload Json class

It supports file/diretory mode and you could use it like that :

var cfg = new Cfg("file.json");
var obj = cfg.get();

if you specify a directory and it has two files :

   dir/a.json
   dir/b.json

you could write code like that :

var cfg = new Cfg("dir");
var obja = cfg.get("a.json");
var objb = cfg.get("b.json");

####Note:

when you use directory mode ,it will auto-load when file add/detele/rename, but if you edit the exsting file, you should 'touch' the directory to trigger the change event to reload