[Pas2js] call from external js files

pas2js at gauns.org pas2js at gauns.org
Tue Jun 18 09:07:37 CEST 2019


Am 2019-06-18 08:44, schrieb Michael Van Canneyt:
> On Tue, 18 Jun 2019, pas2js at gauns.org wrote:
> 
>> 
>>> You can use (as I proposed originally) an external class definition:
>>> (see the external name just after the class keyword)
>> 
>> oh sorry, i missed that
>> 
>>> 
>>> TExternal = class external name 'anonymous'
>>>    public
>>>      name : String;
>>>      function getName : String;
>>>      procedure log( aMessage : String );
>>>    end;
>>> 
>>> 
>>> var
>>>   logger : TExternal; external name 'logger';
>> 
>> would by nice to have it this way, if its possible,
>> but to have the external declaration two times (class and variable) is 
>> also ok, just a wish
>> 
>> type
>>   TExternal = class external name 'logger'
>>   public
>>     name : String;
>>     function getName : String;
>>     procedure log( aMessage : String );
>>   end;
>> 
>> var
>>   ext : TExternal;
> 
> This will never be possible.
> 
> You can declare & instantiate a local instance of an external class, 
> that is
> what your code does.
> 
> The "external" after the ext : texternal is necessary to make clear 
> that
> the variable already exists externally.

thanks michael,
it was just an idea, obviously not an intelligent one :)

cheers
peter



More information about the Pas2js mailing list