How to specify which code runs in each platform

Hi. Could someone point me some documentation that explain how to specify which code should run in each platform?

As JavaScript doesn’t have #ifdef, how do I instruct the engine that some code should be available and executed only on Android, on WEB or in iPhone?

Thanks in advance.

You don’t have compilation flags, but you can check it using one of those inside cc.sys

image

https://docs.cocos.com/creator/api/en/classes/sys.html

1 Like

Thank you.
I’ll read the documentation you point out.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.