Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing name after . operator YUI Compressor for socket.io js files

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.

like image 348
Pradeep Simha Avatar asked Oct 07 '13 04:10

Pradeep Simha


1 Answers

no compressor will mess with reserved words if enclosed in quotes

socket['volatile'].emit() 
like image 102
user32225 Avatar answered Oct 07 '22 05:10

user32225