On Tue, 1 May 2018, Ryan Joseph wrote:

The above would be

Type
  WebGLActiveInfo = class external name 'WebGLActiveInfo'
  Private
   fSize : GLint; external name 'size';
   ftype: GLEnum; external name 'type';
   fName : DOMString ; external name 'name';
 Public
   Property size : GLInt Read FSize;
   Property &type : GLEnum Read fType;
   Propert Name : DomString read FName;
 >>  end;

Interface is just a class? That makes sense but “dictionary” is a real type I 
assume because I know JS has “associative arrays” or hash maps. How do those 
work in Pascal?

Dictionary is just a TJSObject. The properties are the dictionary.


Shouldn’t there be some automatic tool to parse JS api's to Pascal then? Makes 
sense so API’s like this can be dumped out easily.

If all you have is the Javascript type of things, then you can dump out the
api, given an instance of an object.

There is a demo project in the SVN which shows how.

But since in Javascript there are no types, the types will be blank.

If you have access to the underlying API spec in the form of an IDL, then we
could make a tool that parses the IDL and dumps the API in the form of
"external" declarations.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to