javascript - The chicken and the egg -


i have 2 big functions, a , b, in 1 big javascript file. goal have each function in separate javascript file.

the problem a makes calls b, , b makes calls a, if put both functions in different files, 1 missing definition of other, , error message , things break.

when in same file, under same closure, things don't break because of hoisting. how can have 2 functions in different files when each references other?

if they're going in different files, won't have them in same closure, that's fire problem.

after that, if you're willing enforce load order (i.e. load first, b), have define stub of b, , b redefine when loads. long doesn't execute before b loads, should fine.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -