I am trying to use YUI compressor for socket.io based .js file (yes, I know it's server side script and doesn't require minfication, but it's requirement so I have a less control). My code is like this:
fs.readFile('../examples/example.xml', function(err, data) {
if (err) throw err;
// parsing the new xml data and converting them into json file
var json = parser.toJson(data);
// adding the time of the last update
json.time = new Date();
// send the new data to the client
socket.volatile.emit('notification', json);
});
When I execute YUI compressor I get error @ this line:
socket.volatile.emit('notification', json);
[ERROR] 36:22:missing name after . operator
I assume it is throwing error becase volatile is keyword right? Can anyone guide me how to get rid of this error.
no compressor will mess with reserved words if enclosed in quotes
socket['volatile'].emit()