Jump to content

DidierXT

Members
  • Content Count

    52
  • Joined

  • Last visited

About DidierXT

  • Rank

Profile Information

  • Gender
    Male

Business

  • Sector
    Information technology

Smart Mobile Studio

  • Edition
    Enterprise

Recent Profile Visitors

247 profile views
  1. DidierXT

    WebWorker and InitAnimationFrameShim

    Seems I can't retrieve information. I'll send you a test case: SMS 3.0.2.20 - Delphi 10.3.2 - RemObjects 9.6 Server : NewProject.exe Client windows : NewProjectClient.exe OK Client SMS : sms_ro.sproj NO DATA Client JS : test_client.html NO DATA test_ro_sms.zip
  2. DidierXT

    WebWorker and InitAnimationFrameShim

    Hi, I'm trying to setup a webworker to send a file to a RO server. But I've got this error: Uncaught ReferenceError: window is not defined => function InitAnimationFrameShim() { I thought about SmartCL.WebWorker, but it is working without error in the demo projects. Also other commands from the same server are working just fine in the application... Here is the code: uses System, WorkerThreadUploader; {$IFDEF SMART_INTERNAL_HANDLE_EXCEPTIONS} try {$ENDIF} var Thread := TThread.Create; {$IFDEF SMART_INTERNAL_HANDLE_EXCEPTIONS} except on e: Exception do asm console.error(e) end; end; // ------------------------------------------------------------------------ unit WorkerThreadUploader; interface uses SmartCL.WebWorker, RemObjectsSDK, CheckLibrary_intf, Commons; type TThread = class(TWebWorkerThread) private FROServeur : TCheckService; FROChannel : TROHTTPClientChannel; FROMessage : TROJSONMessage; FMyFile : TMyFile; procedure InitializeRemobjects; public constructor Create; procedure ReceiveMessage(data: Variant); override; end; TMyFile = class (JObject) name : string; content : variant; end; const SERVER_ADDRESS = 'http://localhost:8823/json'; implementation constructor TThread.Create; begin inherited Create; InitializeRemobjects(); end; procedure TThread.InitializeRemobjects; begin FROChannel := TROHTTPClientChannel.Create(SERVER_ADDRESS); FROMessage := TROJSONMessage.Create(); FROServeur := TCheckService.Create(FROChannel, FROMessage); end; procedure TThread.ReceiveMessage(Data: Variant); begin FMyFile := TMyFile(Data); FROServeur.AddPhoto( FMyFile.name, FMyFile.content, procedure (aResult: AnsiString) begin PostMessage(Format('File sent: %s ', [FMyFile.name])); end, procedure (aMessage: TROMessage; aError: JError) begin PostMessage(Format('Send error: %s ', [FMyFile.name])); end ); end; end.
  3. DidierXT

    RemObjects and WebWorkers

    Seems the RO interface need an update following changes in RTL files organization. To be able to execute run a TWebWorkerThread, I had to remove SmartCL.System and W3System units from RemObjectsSDK.pas Unknown "window" error. But now calling RO services still fail with this message: Uncaught ReferenceError: RemObjects is not defined
  4. DidierXT

    Using WriteLn in WebWorkerThread

    SmartCL.System is required to use WriteLn. But this unit is not allowed inside a WebWorkerThread unit. Is there another way to output logs?
  5. I didn't find where to customize colors for block delimiters: begin, end, (, [, { Also "lambda" is not included, neither associated with "end".
  6. DidierXT

    File tabs

    Better distinguish the active tab.
  7. DidierXT

    WebWorker project template

    Change the default Javascript file name to worker.js
  8. DidierXT

    WebWorker demo

    Excellent, works fine! A suggestion for our better understanding (and for the fun): Add a "Disconnect" button. procedure TForm1.W3Button1Click(Sender: TObject); begin // if not properly destroyed // the worker thread may continue its life in parallel of new ones // and still report its work! FWorker := nil; EnableButtons; end;
  9. DidierXT

    Working with images in the file system? 

    Was the previous code (with asm) worked for you? Can you try into TForm1.InitializeForm?
  10. DidierXT

    Working with images in the file system? 

    W3C.File
  11. DidierXT

    Working with images in the file system? 

    And shorter without asm: edPhoto1.InputType := itFile; edPhoto1.Handle.ReadyExecute( procedure () begin w3_setAttrib(edPhoto1.Handle, 'accept', 'image/*'); w3_setAttrib(edPhoto1.Handle, 'capture', ''); edPhoto1.OnChanged := procedure(sender:TObject) begin var reader := JFileReader.Create; reader.onload := lambda imgPhoto1.handle.src := reader.result; end; reader.readAsDataURL(JBlob(edPhoto1.handle.files[0])); end; end);
  12. DidierXT

    WebWorker demo

    I've updated to 3.0.0.206 yesterday. I've also deleted WebWorker directory and updated again. Only manipulation is: copy worker.js from \output to \www folder.
  13. DidierXT

    WebWorker demo

    worker.js:3422 Uncaught ReferenceError: window is not defined (anonymous) @ worker.js:3422 InitAnimationFrameShim @ worker.js:3429 (anonymous) @ worker.js:4593
  14. DidierXT

    WebWorker demo

    The project is defined with "customer server" option, and my default browser is chrome. I tried Mozilla too.
  15. DidierXT

    Working with images in the file system? 

    @lynkfs helped me with this procedure: edPhoto1.InputType := itFile; edPhoto1.Handle.ReadyExecute( procedure () begin w3_setAttrib(edPhoto1.Handle, 'accept', 'image/*'); w3_setAttrib(edPhoto1.Handle, 'capture', ''); edPhoto1.OnChanged := procedure(sender:TObject) begin var reader: variant; asm @reader = new FileReader(); end; reader.onload := lambda imgPhoto1.handle.src := reader.result; end; reader.readAsDataURL(edPhoto1.handle.files[0]); end; end);
×