JSteunou / webstomp-client

Stomp client over websocket for browsers
Apache License 2.0
299 stars 59 forks source link

_parseConnect: Use 'typeof args[1] === 'function' instead of 'args[1] instanceof Function', as this does not work if script was loaded in another iframe #23

Closed paxdei closed 8 years ago

paxdei commented 8 years ago

See http://javascript.info/tutorial/instanceof and http://stackoverflow.com/questions/26248599/instanceof-htmlelement-in-iframe-is-not-element-or-object

I have this problem in a GWT application, where the application-script is loaded in a dedicated iframe.

Always have to hotfix it manually, thought it could go to the official source

JSteunou commented 8 years ago

Weird I think it should work even in an iframe in any modern browser. Anyway the dist code is generated through babel as webstomp client is written in ES6. So either you can use the ES6 version or you should open an issue directly on the babel project

Le 29 août 2016 19:11, "Gottfried Huber" notifications@github.com a écrit :

See http://javascript.info/tutorial/instanceof and http://stackoverflow.com/questions/26248599/instanceof- htmlelement-in-iframe-is-not-element-or-object

I have this problem in a GWT application, where the application-script is loaded in a dedicated iframe.

Always have to hotfix it manually, thought it could go to the official source

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JSteunou/webstomp-client/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNyt7ixyvd84XwPJ6TRymMpXgLtg960ks5qkxK9gaJpZM4Jvr3v .

paxdei commented 8 years ago

Hi, I am actually referring to the ES6 source, client.js #369

Without "hacking" it to typeof it never passes this if test in my environment, so the error callback is not recognized

JSteunou commented 8 years ago

Still an issue? Here you can see this should work in a iframe https://jsfiddle.net/f3z2tv1f/