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

Read properties from WebSocketFallback constant, or from global constant #81

Closed imanel closed 13 years ago

imanel commented 13 years ago

As we talked earlier I implemented draft of unified variable.

Currently user can implement his own WebSocketFallback variable with all or just selected options. He is also allowed to use old global variables, so both are valid:

WebSocketFallback = {
  swf_location: 'my_path';
}

window.WEB_SOCKET_SWF_LOCATION = 'my_path';

In current approach each variable will be loaded at initalize and will be remembered in that state. This can be changed by wrapping some variables in functions:

WebSocket.__swfLocation = function() { readProp('swf_location', 'WEB_SOCKET_SWF_LOCATION'); }

and later using it as function:

WebSocket.__swfLocation() #=> this will read property from both unified and global variable each time it is called.

Please share any suggestions - as I said this is just draft for discussion, but it's working right now.

gimite commented 13 years ago

As I said in #80, I won't take this option.