if_on_client

Runs its block only when the code around it has been placed on the device (the client). It does not move code: the compiler decides where the surrounding code runs, and if_on_client merely reacts to that decision. When the surrounding code lands on the server, the block is left out of the app. Write it as a pair with an if_on_server block in the same block of code: the pair says what happens on each side, so that one piece of code (a macro, a preset, a reusable routine) is right wherever the compiler places it; the half that does not apply is dropped on purpose. An if_on_client whose block is left out and that has no if_on_server beside it is a compile warning: the answer is the missing half, never moving the code, adding location declarations or splitting the activity.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

if_on_client { [statements] }

Examples

// sleep one second wherever this code ends up
if_on_client {
    JS

JS } if_on_server { PHP< sleep(1); >PHP }