Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to call js file inside another js file? #13

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 5 comments
Open

how to call js file inside another js file? #13

GoogleCodeExporter opened this issue Mar 24, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

is there any way to call one js file from inside another js file and execute 
the whole script?

thank you.


Original issue reported on code.google.com by rgray...@gmail.com on 24 Dec 2012 at 9:52

@GoogleCodeExporter
Copy link
Author

To do that, you would have to write a 'native function' that took a filename, 
loaded the file into a string, and then called tiny js's execute method on it.

It is quite easy, but there are no built in filesystem access functions

Original comment by marianne...@googlemail.com on 24 Dec 2012 at 4:09

@GoogleCodeExporter
Copy link
Author

thank you .. and is it going to be recursive? because 'native function' is 
going to execute first file but still there is another call inside this file ..

Original comment by rgray...@gmail.com on 24 Dec 2012 at 6:32

@GoogleCodeExporter
Copy link
Author

It should be, as long as you don't do anything that isn't re-entrant in your 
function.

Original comment by Morph...@googlemail.com on 24 Dec 2012 at 10:17

@GoogleCodeExporter
Copy link
Author

so the native function should be able to fread all the files including inner 
files into a big stream and execute it all at once. correct?

Original comment by rgray...@gmail.com on 24 Dec 2012 at 10:23

@GoogleCodeExporter
Copy link
Author

Dear  marianne,
I just added scCmdCall function into the script.cpp file and also registered 
the native function. inside the scCmdCall function I'm parsing a test file and 
executing the buffer but unfortunately keep getting an error. 
I just attached the modified script.cpp file here. would you please take a look 
at this script and let me know what I'm doing is wrong?

-Roozbeh

Original comment by rgray...@gmail.com on 25 Dec 2012 at 8:58

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant