Everything else that doesn't fall into one of the other categories.
falsam
Posts: 280 Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:
Post
by falsam » Fri Nov 04, 2016 10:40 am
This example (from help) works fine.
Code: Select all
Procedure MyProcedure()
Debug "Hello world"
EndProcedure
; Call in SpiderBasic
MyProcedure()
; Call using Javascript
!f_myprocedure();
but not this code
Code: Select all
Procedure MyProcedure()
Debug "Hello world"
EndProcedure
; Call using Javascript
!f_myprocedure();
Thanks for your help.
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Fred
Site Admin
Posts: 1510 Joined: Mon Feb 24, 2014 10:51 am
Post
by Fred » Fri Nov 04, 2016 10:40 am
You need to reference your procedure in SB code at least once or it will get removed by the code optimizer.
falsam
Posts: 280 Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:
Post
by falsam » Fri Nov 04, 2016 10:48 am
Fred wrote: You need to reference your procedure in SB code at least once or it will get removed by the code optimizer.
Like the first code ? For me this is a non sense.
Code: Select all
Global dummy
Procedure MyProcedure()
dummy + 1
EndProcedure
; Call in SpiderBasic
MyProcedure()
; Call using Javascript
!f_myprocedure();
!alert(v_dummy)
Last edited by
falsam on Fri Nov 04, 2016 10:50 am, edited 1 time in total.
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Fri Nov 04, 2016 10:48 am
Fred wrote: You need to reference your procedure in SB code at least once or it will get removed by the code optimizer.
in this case:
i think it's more elegant when Declare do the Job:
Greetings ... Peter
mdp
Posts: 31 Joined: Fri Oct 06, 2017 10:37 am
Post
by mdp » Tue Oct 10, 2017 8:23 am
Peter wrote: i think it's more elegant when Declare do the Job:
Declare MyProcedure()
Absolutely, it's ok to have the optimizer working but we need a good solution to force the compilation of a procedure meant to be called with "inline JS".