mikedeboer / jsDAV

jsDAV allows you to easily add WebDAV support to a NodeJS application. jsDAV is meant to cover the entire standard, and attempts to allow integration using an easy to understand API.
http://www.mikedeboer.nl
MIT License
681 stars 159 forks source link

dispatchEvent with multiple arguments in the callback #133

Closed mnutt closed 8 years ago

mnutt commented 9 years ago

I noticed in lib/DAV/handler.js in createFile() it does:

self.dispatchEvent("beforeCreateFile", uri, dataOrStream, enc, parent, function(stop, etag) {

This looks like it was added in https://github.com/mikedeboer/jsDAV/commit/d9a1005f02a7124e0548045f143c924f9902e9e3 for parity with the way other functions pass an etag. But is it possible to actually pass an etag back as a second argument in my beforeCreateFile handler? Or if not, is there a workaround for it?

Right now I'm just not calling e.next() at all from my listener and just finishing the request myself, but it means I have to disable the listener timeouts which seems ugly.

mikedeboer commented 8 years ago

Sorry for the late reply! I think you should be able to pass back an etag - just like the other beforeCreateFile handlers do. Please check the linked commit :wink: