[Pas2js] TJSCrypto name minor error
Michael Van Canneyt
michael at freepascal.org
Mon Aug 12 14:38:46 CEST 2019
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);
Michael.
More information about the Pas2js
mailing list