#1 2018-10-22 09:30:27

erick
Member
Registered: 2015-09-09
Posts: 155

named parameters to interface functions

Hi,

I have a huge app written in ElevateWebBuilder - to - JavaScript which makes extensive use of interface functions.

But somewhere along the way, mormot changed how data can be sent to interface functions.  Before I was able to use named JSON variables
eg. with the calculator Example #14

{ "n1" = 3, "n2" = 4 }

Which was convenient because sometimes the order might be different, but mormot would marshall all variables to the correct input parameter.

But mormot has changed its input default to arrays (looking again at example 14)

[ 3, 4 ]

Is there still a way to pass names, so that I don't have to worry about order of parameters?

Thanks
Erick

Offline

#2 2018-10-22 09:33:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,670
Website

Re: named parameters to interface functions

Passing named values is supported, as an alternative to the array.
We didn't change anything about that.

Only between Delphi client/server with a valid contract will the array layout be used.

Offline

#3 2018-10-22 09:34:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,670
Website

Re: named parameters to interface functions

Note that { "n1" = 3, "n2" = 4 } is not valid JSON.

The syntax is { "n1": 3, "n2": 4 }

Offline

#4 2018-10-22 09:50:07

erick
Member
Registered: 2015-09-09
Posts: 155

Re: named parameters to interface functions

ab wrote:

Note that { "n1" = 3, "n2" = 4 } is not valid JSON.

The syntax is { "n1": 3, "n2": 4 }

Right, it was 4am here and so I mistyped.

I get errors, maybe it's because I'm using contracts with the correct JSON.

I'll try without.

Erick

Offline

#5 2018-10-22 10:04:11

erick
Member
Registered: 2015-09-09
Posts: 155

Re: named parameters to interface functions

Solved, thanks.

Erick

Offline

#6 2018-10-22 17:16:52

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: named parameters to interface functions

@erick, how can you write a huge app with ElevateWebBuilder without code-completion?


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB