brikteknologier / seraph-model

thin model layer for seraph/neo4j (node.js)
MIT License
111 stars 28 forks source link

add multiple prepare functions to the prepare event #94

Closed beebase closed 9 years ago

beebase commented 9 years ago

Is there a way to add multiple functions to the prepare event?

something like: Model.on('prepare', [prepareFileName, prepareUuId]);

beebase commented 9 years ago

I found this notation in the docs

var  prepareUuId = function(obj, cb)...
var  prepareFileName = function(obj, cb)...
Model.preparers.push(prepareUuId, prepareFileName);

...but it errors with

Model.preparers.push(prepareUuId, prepareFileName);
               ^
TypeError: Cannot read property 'push' of undefined 
jonpacker commented 9 years ago

I can't find a reference to that in the docs, it would be outdated if it remained. The correct way to do it is:

Model.on('prepare', prepareUuId);
Model.on('prepare', prepareFileName);