2013-10-07 38 views
11

我想使用YUI壓縮機爲基於.js文件的socket.io(是的,我知道它是服務器端腳本,並不需要minfication,但它的要求,所以我有一個較少控制)。我的代碼是這樣的:之後缺少名字。運營商YUI壓縮機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); 
}); 

當我執行YUI壓縮機我得到錯誤@這一行:

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

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

我認爲它是揮發性becase的關鍵字是正確的投擲的錯誤?任何人都可以指導我如何擺脫這個錯誤。

+4

插座[ '揮發性']。發射() – user32225

+0

@ user32225哇!!那很棒。如果你把它作爲答案發布,我可以upvote並接受:) –

+0

Thaks的小費,我會做。 – user32225

回答

18

無壓縮機會搞亂與保留字,如果包含在引號

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

效果很好,用'.super'屬性解決了我的類似問題 – MightyPork