Jump to content


  • Content Count

  • Joined

  • Last visited

About DidierXT

  • Rank

Profile Information

  • Gender


  • Sector
    Information technology

Smart Mobile Studio

  • Edition

Recent Profile Visitors

319 profile views
  1. Seems I can't retrieve information. I'll send you a test case: SMS - 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. 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. 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. 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. Better distinguish the active tab.
  7. 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. Was the previous code (with asm) worked for you? Can you try into TForm1.InitializeForm?
  10. 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);
  11. DidierXT

    WebWorker demo

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

    WebWorker demo

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

    WebWorker demo

    The project is defined with "customer server" option, and my default browser is chrome. I tried Mozilla too.
  14. @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);
  • Create New...