-
Notifications
You must be signed in to change notification settings - Fork 35
CoreFeatures
CoreFeatures is an Enum to indicate what built-in features can be provided by ReoScript run-time for script executing.
When you create ScriptRunningMachine, you may pass the CoreFeatures enum to indicate what features are enabled. (Default CoreFeatures is StandardFeatures)
ScriptRunningMachine srm = new ScriptRunningMachine(CoreFeatures.StandardFeatures);
To change CoreFeatures to FullFeatures:
ScriptRunningMachine srm = new ScriptRunningMachine(CoreFeatures.FullFeatures);
In same case, you may want to allow your customer to use or edit script, but you don't want customer could use alert internal function, then you can:
CoreFeatures features = CoreFeatures.StandardFeatures & ~(CoreFeatures.Alert);
ScriptRunningMachine srm = new ScriptRunningMachine(features);
Now the built-in alert function will not be provided. When the following script be executed...
srm.Run("alert('hello');");
A run-time exception will be caused.
Function is not defined: alert
The following built-in features are available to provide for script executing, they could be enabled or disabled by CoreFeatures enum.
-
StandardFeatures
- Alert: alert internal function
- Eval: eval internal function
- AsyncCalling: Async calling such as setTimeout and setInterval internal function
- console: console internal object
- JSON: JSON internal object
-
ExtendedFeatures
- ArrayExtension: Linq-like Array Operations Library
-
FullFeatures
- StandardFeatures
- ExtendedFeatures