The pattern the Kernal has been using is to keep a reference to 'this' in a slot called owner.  The reference is passed in at construct time.  From the Kernel spec:

new TextSprite( Object:owner )

The constructor has one argument:

  • a reference to the owner object
Is implemented as:

LzTextSprite = function(owner) {
    if (owner == null) return;
    this.owner = owner;

It would be good to standardize on this pattern, unless anyone has objections.

-Max

Henry Minsky wrote:
I've been getting away with binding some other variable to "this" to capture it...


On 7/14/06, P T Withington < [EMAIL PROTECTED]> wrote:
I think that has to be the case.  Just as the API's have to use plain
_javascript_ types (cannot use LFC types), we need to use a plain
_javascript_ mechanism for events across this API.

Note that for ECMA4 it is proposed that a method closure will capture
`this`.  Perhaps there is a way to simulate this in the compiler, if
that would help?

On 2006-07-14, at 12:29 EDT, Henry Minsky wrote:

> So did we decide that it is a policy that kernel functions don't
> send Laszlo
> Events back to the LFC, they just use callback functions?
> I don't really have a strong feeling one way or the other on this.
>
>
> On 7/14/06, Max Carlson <[EMAIL PROTECTED]> wrote:
>>
>>
>> Henry Minsky wrote:
>> >
>> >
>> >
>> >
>> >     Or be more like XMLHTTPRequest, where the request type is
>> just a
>> >     parameter, instead of having a method for each request type?
>> >
>> >
>> > I actually like that better, given that we may want to add other
>> > parameters.
>> >
>> This does sound better.  I'll update the Kernel API Spec.
>>
>> -Max
>>
>
>
>
> --
> Henry Minsky
> Software Architect
> [EMAIL PROTECTED]




--
Henry Minsky
Software Architect
[EMAIL PROTECTED]

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to