1

I need to listen the js functions, get the name of that function in order to look up that function inside my js files in order to create the tag inside the head to provide the source, I have seen different on demand solutions, but can't find this particular need.

it will be something like:

js function excecute > listen function > get name of the function > match the js file with the function called > create the script src inside the head to provide the js file.

Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136
Andy Chaves
  • 137
  • 1
  • 2
  • 9
  • 3
    Not clear (to me) what you are attempting to do. What is the big picture here? – fred02138 Oct 08 '13 at 17:35
  • 1
    So you want to auto-load a JS file when an undefined function is called? Pretty sure you can't do that. See: http://stackoverflow.com/a/10226175 – gen_Eric Oct 08 '13 at 17:36
  • 2
    If you have a list of possible functions that can be called, you could easily define dummy versions of them from that list that load in the required js then re-execute the function. You can't have it auto detect the functions though, as previously mentioned. – Kevin B Oct 08 '13 at 17:39
  • You can try playing with try/catch and catch "Uncaught ReferenceError: function is not defined" but it can get messy – Yuriy Galanter Oct 08 '13 at 17:41
  • 1
    Look at RequireJS; you probably want it. – SLaks Oct 08 '13 at 17:43
  • @fred02138 I have a pl/sql that create html front end, is a custom system, each section call group of js files, not all are used, i call the group using a simple function, but i have a lot of trash loading, I would like to do two things, provide js ondeman, or run a pl/sql package which will create and run the html, and with javascritp know which documents where execute, that way i can save them in a table with the package name, that way the next time, it will load just the needed js documents. – Andy Chaves Oct 08 '13 at 17:46

0 Answers0