Home > @lynx-js/rspeedy > Source > define
Source.define property
The define options is used to define some values or expressions at compile time.
Signature:
Remarks
-
If the value provided is a string, it will be utilized as a code fragment.
-
If the value provided is an object, all its keys will be defined in the same manner.
-
If the value isn't a string, it will be stringified, with functions included.
-
Notably, if a
typeofprefix is attached to the key, it will be exclusively defined fortypeofcalls."
Example 1
Using define for environment variables.
Expressions will be replaced with the corresponding code fragments:
Example 2
Using define for typeof.
The typeof expressions will be replaced with the corresponding code fragments:
Example 3
Using define with objects.
Expressions will be replaced with the corresponding code fragments: