Reputation: 181
I am automating an iPhone application in Macintosh using "Intruments" tool.
and the Scripting language incorporated is "JavaScript".
I want to use the function written in "a.js" in "b.js" also. Can anyone tell me a way to achieve this.
Note : the iPhone application is not web based application and hence the following code snippets results in Parse errors
document.write("<script type='text/javascript' src='a.js'></scr"+"ipt>"); //can't reference the variable "document"
<script type='text/javascript' src='a.js'><script>
import "a.js"
Thanks Kiran
Upvotes: 1
Views: 551
Reputation: 181
#import "a.js"
The above statement will import a.js
file in whatever the file you typed in and the code in that file can be re-used.
Upvotes: 1
Reputation: 2983
When you add the JavaScript file, Xcode detects that the file is a source code file, assumes you want to compile it and automatically adds it to the Compile Sources build phase.
To stop Xcode trying to compile it and make it copy the file instead, expand your target in the Groups and Files list, remove the JavaScript file from the Compile Sources build phase and add it to the Copy Bundle Resources build phase.
EDIT :
Maybe these links will help you -
1)Introduction to Dashcode User Guide 2)Dashcode Tips And Tricks
Good Luck
Upvotes: 0