JavaScript + LC HTML5 = LiveCode.js

Peter TB Brett peter.brett at livecode.com
Fri Nov 25 09:42:45 EST 2016


On 25/11/2016 04:38, Todd Fabacher wrote:

> Mark, One question I had that was NOT answered is..Can a JavaScript
> function call a LiveCode function? I know this was added in the LC8 browser.

Hi Todd,

Mark and Kevin are on holiday today, but I'll try and address this for you.

At the moment, JavaScript functions cannot call LiveCode functions.  Our 
current plan is to make this work in December or January.

It will be more difficult to implement than the new "do script as 
JavaScript" feature, but much easier than making the "url" chunk work 
the same way as on other platforms.

The latest idea we've had to make this happen is to let you set the 
"javaScriptHandlers" property on a stack.  This will be a list of 
message names that the web page is allowed to send to the stack.

We'll then add a JavaScript function to the standalone, that lets you 
send a message to the current "defaultStack".  For example:

     Module.LiveCodeSendMessage("<message>", ["<param1>", "<param2>"])

If <message> is not among the lines of the "javaScriptHandlers" of the 
defaultStack, then it'll be ignored.  Otherwise, it'll be sent to the 
current card of the defaultStack, just like "backKey" message on mobile 
platforms, for example.

That's the current plan, anyway.  No doubt it will change a bit once we 
start working on it.  Does that broadly answer your question?

Best regards,

                                                Peter

-- 
Dr Peter Brett <peter.brett at livecode.com>
LiveCode Technical Project Manager

lcb-mode for Emacs: https://github.com/peter-b/lcb-mode




More information about the use-livecode mailing list