The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Micro.blog
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
May 2, 2006
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

Tuesday, May 2nd, 2006

So I'm looking for a JavaScript - objc bridge that works with JavaScriptCore, much like this one by Will Thimbleby.. only without the webview hack. (Not to belittle what Will has done, I just want someting to use the javascript libs directly without involving the whole of webkit). Has anyone seen such a thing, has it already been written?

Here's an example of what I'm dreaming of...

JSEngine *js = [[JSEngine alloc] init]; [js setValue:windowCotroller forKey:@"windowController"]; [js evaluateWebScript:@"windowController.textView().insertText_('Hello World');"] [js release];

And that would.. you know, do what it looks like. Insert "Hello World" into a text view that's available from the windowController.

I've taken a look at the source for webkit, which talks to kjs (which is what JavaScriptCore is based on) and it looks like everything is mostly there... the pieces just have to be put together. I really want to put it together myself, but this little ada thing is sneaking up on me.

...

And in case anybody is wondering, no- I'm not abonding Lua for JavaScript. So many more people know JavaScript already and I'd be a fool not to take advantage of that.

-- posted 11:34 pm