gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

Some fixes for FABridge #38

Closed nene closed 13 years ago

nene commented 14 years ago

Stumbled upon some problems when trying to use web-socket-js on my webapp.

Tracked the problems down to the FABridge assuming it runs in global scope.

Fixed that and few other minor things.

With best wishes,

Rene Saarsoo

gimite commented 14 years ago

When concatenating FABridge with other scripts into one big .js file, it can happen that the FABridge.js code is no more run in global scope,

Do you mean when you concatenate it with other files, you surround the whole script with (function(){ ... })(); or something? What's motivation to do so? If you simply just concatenate it with other scripts, it won't be an issue.

I'd like to keep modification to third-party library minimal, so I patched your fix for newType variable, which is clearly a bug, and kept other parts, which looks harmless at least.

nene commented 13 years ago

It's really our build system that that merges all the dependencies in and it just happens, that FABridge is included in a spot where it ends up inside a closure. It took almost a full day to track this bug down, so I thought it might save someone from the pain that I had.

Anyway... I have reported all those issues to Adobe. But I have no idea if and when they are going to fix those things.

gimite commented 13 years ago

Hm, I'm not sure how popular such build system is, so I'll keep it as is for now... I guess in general you cannot assume a JS library works fine if it's put inside closure.