> On 19 Jul 2016, at 1:49 AM, Richard Gaskin <ambassa...@fourthworld.com> wrote:
> 
> ...where Monte has this note:
> 
>   Previously global handlers took priority
>   over handlers scripted in LCS. This patch
>   enables a LCS handler the handle the global
>   handler instead. This is necessary for
>   for overriding the libURL commands on mobile.
> 
> Can you or Monte elaborate on that?  Is a "global handler" and engine 
> handler?  Does this mean we can now override engine-defined functions?

Aha! Yes as Mark Wieder mentioned this pricked his interest also but it isn’t 
as exciting as it seems. The engine has some platform specific handlers (mainly 
used on mobile for mobile* handlers) that are resolved at runtime like script 
and external handlers but were previously getting dealt with first and the 
scripts in the message path weren’t getting a chance to implement handlers with 
those names. In the specific situation we were trying to resolve we wanted 
libURL to be able to handle the two libURL commands implemented in the engine 
on mobile. BTW I’m not sure why the term global handler was used because they 
are really platform handlers.

Anyway… previously:

object -> handle:
     is it a global handler?
          yes -> handle in engine
          no  -> front scripts, object, behaviors, [owner, behavior …] , 
libraries, back scripts, externals, error

Now:
     front scripts, object, behaviors, [owner, behavior …] , libraries, back 
scripts, externals
     is it a global handler?
          yes -> handle in engine
          no -> error

So this means I could write an external that implemented one of the mobile* 
commands and then write a library that handled that command and redirected the 
parameters to my external. It’s worthwhile noting, however, that we currently 
haven’t allowed pass to work so you can’t:

on mobileCommand
    if the platform is “ios” then
       -- do something different
    else
       pass “mobileCommand"
    end if
end mobileCommand

I think in hindsight we probably should have allowed that because I can think 
of some interesting use cases. For example, mergAVPick could override 
mobilePickPhoto on iOS and support a few extra things.

Cheers

Monte


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to