Skip to content
Jing Lu edited this page May 28, 2013 · 7 revisions

CoreFeatures is an Enum to indicate what built-in features can be provided by ReoScript run-time for script executing.

Change CoreFeatures

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

Feature List

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