Re: JSA -- now I believe this is a bug (JSA or AS)
Re: JSA -- now I believe this is a bug (JSA or AS)
- Subject: Re: JSA -- now I believe this is a bug (JSA or AS)
- From: Shane Stanley <email@hidden>
- Date: Thu, 18 Dec 2014 23:04:40 +1100
On 18 Dec 2014, at 3:58 pm, Deivy Petrescu <email@hidden> wrote:
I wrote a script library to do a bunch of computations that are not there in Smile natively.
So I had a look at _javascript_Core, and it looks like you can call it directly using ASObjC, and without WebKit. That should let you avoid using the buggy bridge business, and as a bonus, it looks like the overhead is lower -- your sample line runs 3-4 times faster.
So instead of doing this:
set k to run script "Math.tan((Math.PI)/3)" in "_javascript_"
You do this:
use framework "Foundation" use framework "_javascript_Core"
set theContext to current application's JSContext's alloc()'s init() set theJSValue to theContext's evaluateScript:"Math.tan((Math.PI)/3)" set k to theJSValue's toDouble()
If you're doing a bunch of computations, you could reuse the JSContext and do the rest in a single line. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden