Module: widgets/wFunction.js

File for dealing with wFunctions.

Author:
  • Mjduniverse
Source:

Type Definitions


afterslchangeTriggerString

The "afterslchange" trigger means that the simple event will execute after the superlayer changes.

Type:
  • "afterslchange"
Source:

firstslupdateTriggerString

The "firstslupdate" trigger means that the simple event will execute during the first update of the simulation.

Type:
  • "firstslupdate"
Source:

keyTriggerString

The "key" trigger means that the simple event will execute if a key is pressed.

Type:
  • "key"
Source:

objclickTriggerString

The "objclick" trigger means that the simple event will execute if the mouse clicks on the trigger object. However, the "objclick_global" trigger means that the simple event will execute if the mouse clicks on any object in general.

Type:
  • "objclick" | "objclick_global"
Source:

objlinkTriggerString

The "objlink" trigger means that the simple event will execute if the trigger object is linked to another object by the objlink widget.

Type:
  • "objlink"
Source:

objMouseDownTriggerString

The "objmousedown" trigger means that the simple event call is executed if the mouse is being pushed down on the object. The "objmousedown_global" trigger means that the simple event will execute if the mouse clicks on any object in general.

Type:
  • "objMouseDown" | "objmousedown_global"
Source:

objmouseupTriggerString

The "objmouseup" trigger means that the simple event will execute when the mouse is let go of while the mouse is over an object. The "objmouseup_global" trigger means that the simple event will execute if the mouse is let go of while it is over an object.

Type:
  • "objmouseup" | "objmouseup_global"
Source:

sensorTriggerString

The "sensor" trigger means that the simple event will execute if the trigger object collides with an object that shares at least one of the sensor classes. However, the "sensor_global" trigger means that the function will execute if any two objects that share at least one sensor class collides.

Type:
  • "sensor" | "sensor_global"
Source:

timeTriggerString

The "time" trigger means that the simple event will execute by some interval of time.

Type:
  • "time"
Source:

WFunction()

A widget function is a function that used for the WidgetFunction widget. The "this" keyword in the body of function usually refers to the current instance of PhSim simulation or references an instance of PhSim.DynObject.

To learn more, see the Widget Functions

Properties:
Name Type Argument Description
_options function

Options used to create WFunction

_ref function | Number
_name String <optional>

WFunction name

_bodyFunction function

Body Function

_eventclass String

Event class

Source:

WFunctionBody(e)

This:
Parameters:
Name Type Description
e Event

event object

Source:

WFunctionOptions

Properties for a simple event. The simple event options is an Object that is used for the PhSim#createWFunction function. They are also used to configure various types of widgets. Especially widgets that utilize wFunctions.

Type:
  • Object
Properties:
Name Type Argument Description
key KeyBoard <optional>

The event.key value for triggering a simple event.

time Number <optional>

The time interval between a repeated event or a delay time for timeouts.

maxN Number <optional>

The maximum number of times a repeated SimpleEvent can be executed.

wFunctionObj PhSim.DynObject <optional>

An object being affected by the wFunction.

name String <optional>

The name of the wFunction

Source:

wFunctionTrigger

The simple event trigger string is a string defining WFunctionOptions.trigger

Type:
  • keyTriggerString | sensorTriggerString | objclickTriggerString | objMouseDownTriggerString | firstslupdateTriggerString | objmouseupTriggerString | objlinkTriggerString | afterslchangeTriggerString | timeTriggerString
Source: