Damián M. González
2014-Jun-22 00:35 UTC
Strange behaviour with two *.js which has window.onload directives
Hi fellows, how are you? I'm stuck here with this. Perhaps you will suggest me to learn some more abstracted JS framework but by now I'm trying to learn the deeps of raw JS. I have 2 files, one is app/javascript/file_1.js and the other is app/javascript/namespace/file_2.js . Both of them do: window.onload = function() { // something } Both gets required by the application.js manifest, I've tested it putting an alert('Eyaa') on both files, alert gets executed twice, so working, good. Here comes the issue: just one window.onload get listened, the other not. The one listened is the first required(first file required). I wonder why does this happen? One file is for one view, and the other file is for another view, I want to have the code splitted, for order. Don't have a clue. Can you help me? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3f051c5ab2c9ecd92afc3ee8db7d7ac1%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.