Is there a pas2js way of doing what this javascript code does?
var Image = new Uint8ClampedArray([0,0,0,255,0,0,0,255,0,0]);
Mailing lists / pas2js / 2021-10
21 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Is there a pas2js way of doing what this javascript code does?
var Image = new Uint8ClampedArray([0,0,0,255,0,0,0,255,0,0]);nick's hardware wroteIs there a pas2js way of doing what this javascript code does? var Image = new Uint8ClampedArray([0,0,0,255,0,0,0,255,0,0]);
This works:
var
a : TByteDynArray;
Image : TJSUint8ClampedArray;
begin
a:=[0,0,0,255,0,0,0,255,0,0];
Image:=TJSUint8ClampedArray.From(a);
end;Michael.
thank you Michael. I would of never thought of this. i was using a for loop to copy from a regular pasal constant array to clamped array. I knew it wasn't the best but didn't think there was better way. I'm glad i asked.
Dear specialists,
I would like to know, if is it possible to control scanner device connected to The Windows computer by using USB data connection by using Pas2JS units. Or if is it too complex task for Java script language from browser so it is impossible for now.
Thank you very much.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211011/1000097d/attachment.htm>
No, this is not allowed by the browser.
Michael.
I think too it's impossible for a scanner and in the general case.
But for a Leonardo, a special kind of Arduino, under Windows 10 , with Google Chrome (I think even Chromium won't work), you can use the WebUSB standard :
https://experiments.withgoogle.com/tiny-sorter
After a long time and a lot of tests, I could make it work. This app is made in HTML5/Javascript but not with pas2js. I imagine it would be possible to play with the Leonardo and access it from the browser from an app made with pas2js.
Dear Jean,
Thank you very much for yours answer.
I AM aware that I would want too much from Javascript. But future may be allow even scanning not only from USB but from Bluetooth. May bbe, that even Bluetooth scanners exist or will exist. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211012/f2a53e8e/attachment.htm>
Mgr. Janusz Chmiel wroteDear Jean, Thank you very much for yours answer. I AM aware that I would want too much from Javascript. But future may be allow even scanning not only from USB but from Bluetooth. May bbe, that even Bluetooth scanners exist or will exist.
You can already connect to bluetooth devices today with Javascript.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API
Mattias Gaertner, who handles the compiler, has - I think 2 years ago - worked on a small demo project that allowed to talk to Bluetooth devices.
Michael.
Dear specialists,
I Am experiencing very deepsadness, because I can not build latest Pas2js from gitlab and even from github. Here is The output of terminal window. Some files are not being downloaded from Github tree and I can not determine what is going wrong. C:/lazarus/fpc/3.2.0/bin/i386-win32/ppc386.exe fpmake.pp Free Pascal Compiler version 3.2.0 [2021/02/21] for i386 Copyright (c) 1993-2020 by Florian Klaempfl and others Target OS: Win32 for i386
Compiling fpmake.pp
Linking fpmake.exe
251 lines compiled, 0.8 sec, 329056 bytes code, 15332 bytes data ./fpmake.exe compile --os=win32 --cpu=i386 -o -di386 --compiler=C:/lazarus/fpc/3.2.0/bin/i386-win32/ppc386.exe -bu Start compiling package pas2js for target i386-win32. Warning: Source file "pas2js.pp" from package pas2js not found for i386-win32 Warning: Source file "webidl2pas.pp" from package pas2js not found for i386-win32 Warning: Source file "compileserver.pp" from package pas2js not found for i386-win32 Warning: Source file "makestub.pp" from package pas2js not found for i386-win32 Warning: Source file "pas2jslib.pp" from package pas2js not found for i386-win32 The installer encountered the following error:
Could not compile target pas2js from package pas2js make: *** [all] Error 1
How could I download latest Pas2JS unstable source, which will be possible to build?
Sure, I have read Lazarus Pas2JS wiki page.
git clone https://gitlab.com/freepascal.org/fpc/pas2js.git And I have used Make file and Lazarus compiler which is The part of Lazarus stable available for download. Thank you for yours help how to download source code completely. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211015/c1f89b66/attachment.htm>
And The following github link require to provide credentials and it is impossible to simply do not add them.
git clone https://gitlab.com/freepascal.org/fpc/fpc.git compiler -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211015/66343beb/attachment.htm>
Mgr. Janusz Chmiel wroteAnd The following github link require to provide credentials and it is impossible to simply do not add them. git clone https://gitlab.com/freepascal.org/fpc/fpc.git compiler
This URL does not exist. The correct URL is
https://gitlab.com/freepascal.org/fpc/source.git
Where did you get the URL you used ?
Michael.
I Am experiencing very deepsadness, because I can not build latest Pas2js from gitlab and…
It seems the wiki page contained an old git URL. I corrected it.
You can also use a git submodule, instructions for how to do this are in the README file.
Michael.
This URL does not exist. The correct URL is https://gitlab.com/freepascal.org/fpc/source.g…
I have obtained this link by using The following article.
Wiki article link
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/d152aa73/attachment.htm>
Thank you.
I have already corrected the link.
Michael.
Thank you very much for yours explanation and for link repair also on Wiki page. Unfortunately, I Am getting other error, but Pas2js.exe have been compiled so it would not be problém.
Compiling .\compiler\packages\fcl-web\src\base\fphttpserver.pp fphttpserver.pp(24,3) Fatal: Can't find unit fpthreadpool used by fphttpserver Fatal: Compilation aborted
make: *** [all] Error 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/f310b499/attachment.htm>
Thank you for pointing it out.
This will take some time to resolve properly.
There are too many dependencies meanwhile; Looks like pas2js itself will need to be built as part of FPC. I'll discuss this.
Michael.
So it would be The best to use The latest stable from April month. I will return to The official latest stable to build WEB apps. By The way. I have made very big joy to mi sister thanks to Pas2js. Because I have been able to produce little WEB app which was nice also for sighted users. Thank you for yours complex programmers work. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/53d142aa/attachment.htm>
Thank you for pointing it out. This will take some time to resolve properly. There are…
I have found other solution. I will use professional building tool. Mr Don have been so kind that he has even prepared screen reader friendly variant of this building tool. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/479ff4f1/attachment.htm>
Thank you for pointing it out. This will take some time to resolve properly. There are…
Does somebody of us think, that it would be possible to detect hardware buttons pressed on Bluetooth or wiret headsets? Buttons play/Pause or if AN headset uses special other buttons to switch between songs. Because Youtube and other WEB apps can detect it. Is it possible with Pas2JS and with some of provided units? Or this kind of operation is only supported by using other programming languages than Javascript? If is it possible, would somebody of us tell Me The unit name and which function or procedure should I call to detect, if user has pressed Pause /play hardware button on headset? I have even found some WEB apps which can detect this event if focus resides outside The browser window. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/8f58b404/attachment.htm>
Thank you for pointing it out. This will take some time to resolve properly. There are…
Do you think, that it would be too complex to develop special command, which can read plain text file line by line by using for cycle and array? Does such command exist in Pas2JS systém unit or in some other unit? I need to read line by line, no whole file to A variable. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20211016/d15c33af/attachment-0001.htm>
Mgr. Janusz Chmiel wroteDo you think, that it would be too complex to develop special command, which can read plain text file line by line by using for cycle and array? Does such command exist in Pas2JS systém unit or in some other unit? I need to read line by line, no whole file to A variable.
No, such a command does not exist. What you can do is read the file in a stringlist and then read the stringlist line by line. The LoadFromURL and LoadFromFile commands exist, and both accept a URL to actually load a file.
You must include the unit Rtl.BrowserLoadHelper in the uses clause for this to work. (or use the browserapp unit)
Michael.