[Pas2js] TJSCrypto name minor error

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Aug 12 14:49:34 CEST 2019


On Mon, 12 Aug 2019 14:38:46 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

> On Mon, 12 Aug 2019, warleyalex via Pas2js wrote:
> 
> > the original definition in Web.pas
> > ===================================
> > TJSCrypto = class external name 'Crypto'  (TJSObject)
> >  private
> >    Fsubtle: TJSSubtleCrypto; external name 'subtle';
> >  Public
> >    class procedure getRandomValues (anArray : TJSTypedArray);
> >    property subtle : TJSSubtleCrypto Read Fsubtle;
> >  end; 
> > ===================================
> >
> > ... I need to access the getRandomValues method.
> > e.g.
> >    TJSCrypto.getRandomValues(data); 
> >
> > the method getRandomValues is not available!
> >
> > the minor error within name "crypto" definition, I believe the
> > correct is:
> >
> > TJSCrypto = class external name 'crypto'  (TJSObject)
> >
> > to generate the correct output
> > window.crypto.getRandomValues(array);  
> 
> Nono. You are accessing it wrong.
> 
> This is the code you should be using:
> 
> Window.crypto.getRandomValues(data);

Then it should be " class external name 'Window.crypto' ", should it
not?


Mattias


More information about the Pas2js mailing list