2013-10-07 15 views
11

Sto provando ad utilizzare il compressore YUI per il file .js basato su socket.io (sì, so che è script lato server e non richiede la minifrazione, ma è requisito in modo da avere un valore inferiore controllo). Il mio codice è simile a questo:Nome mancante dopo. operatore YUI Compressore per file socket.io js

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); 
}); 

Quando eseguo compressore YUI ottengo l'errore @ questa linea:

socket.volatile.emit('notification', json); 

[ERROR] 36:22:missing name after . operator 

suppongo che sta gettando errore becase volatili è giusto parola chiave? Qualcuno può guidarmi come sbarazzarsi di questo errore.

+4

presa [ 'volatili']. Emettere() – user32225

+0

@ user32225 wow !! è fantastico. Se lo pubblichi come risposta, posso prevederlo e accettarlo :) –

+0

Thaks per la mancia, lo farò. – user32225

risposta

18

senza compressore si scherza con le parole riservate, se racchiusi tra virgolette

socket['volatile'].emit() 
+0

funziona benissimo, ho risolto il mio problema simile con una proprietà '.super' – MightyPork

Problemi correlati