Organelle for emitting changes in directory with .json files.
The minimal version of nodejs is: Nodejs version 4+
Open your terminal and run:
npm install organic-watch-json-dir --save
{
"location": "/full/path/with/json/files",
"reactOn": ChemicalPattern,
"emit": {
"dataPropertyName": "data",
"onChangeFile": ChemicalType || Function,
"onNewFile": ChemicalType || Function,
"onDeleteFile": ChemicalType || Function,
"ready": ChemicalType,
"errors": ChemicalType
},
"chokidar": {
"awaitWriteFinish": {
"stabilityThreshold": 100,
"pollInterval": 10
}
}
}
reactOn
chemical pattern is optional, if not present will execute during build(construction) phase.
onChangeFile
emits when file has been touchedonNewFile
emits when file has been created or it has been initially foundonDeleteFile
emits when file has been removed (with a cached autoloaded data)
all chemicals have the following shape:
{
type: dna.emit.*,
<dna.emit.dataPropertyName>: JSON,
path: String
}
- note that invalid json files will not trigger emits
- when dna.emit[key] is
Function
it will be invoked asdna.emit[key](c)
wherec
is chemical having the above outlined shape.
ready
is optional, if present will emit in plasma dna specified plain chemical type.
errors
is optional, if present will emit any errors found during loading and parsing respective (new/changed) json files.
We