# OperatorStack

class `cee.``OperatorStack`()

  The `OperatorStack` manages registered `Operator` instances for a view. Any active operators on the stack will be called in a “Last In, First Called” order. An operator event listener method (i.e. onMouseDown, onWheel, onKeyDown, etc.) will return an `OperatorEventStatus` to indicate whether the particular event should be propagated to the next operator in the stack, or if it should be stopped.

  Since multiple operators can be added to the stack and respond to the same single event, the order of operators matters and it is important to understand an operator propagates different events. It is recommend that more global operators, such as the `NavigationOperator`, are added first, and more specific and local operators are added last. This way, local operations can be captured and handled before they are propagated to the more global operations, if so desired.

  When a new operator is pushed to the stack, the operator stack will track the reference to that operator object. You can then use the `OperatorStack.get` method to retrieve a reference to the operator object by name (regardless of whether that operator object is active and on the stack or not). The prevents the need to instantiate and set up the same operator again, and preserves the state of any setup operators. If you push a new instance of an operator with a previously used name, the old operator reference will be replaced with the new one.

  By default, the `OperatorStack` is empty when a `View` is created. It is the developers responsibility to add any desired default operators in your application. You can remove operators with the `OperatorStack.pop`, `OperatorStack.remove`, or `OperatorStack.clear` methods.

Accessors

- `activeOperators`
- `hotKeyOperator`

Methods

- `clear`
- `get`
- `has`
- `indexOf`
- `peek`
- `pop`
- `push`
- `remove`
- `set`
- `size`

## Accessors

`OperatorStack.``activeOperators`()

  Returns the array of active `Operator` objects

  Return type: | [Operator]

`OperatorStack.``hotKeyOperator`()

  Sets the hot key operator for this operator stack. The hot key (Alt/Opt) can be held to temporarily use this operator without reordering the stack. The operator must already be in the stack to be used with the hot key. Other stack operators will not be called while the hot key is held. To remove the hot key operator designation, but keep the operator on the stack, set the hot key operator to null.

  Return type: | Operator

`OperatorStack.``hotKeyOperator`(operator)

  Arguments: | operator (`Operator`) – None
  Return type: | void

## Methods

### clear

`OperatorStack.``clear`()

  Removes all operators from the stack

  Return type: | void

### get

`OperatorStack.``get`(operatorName)

  Arguments: | operatorName (`S`) – None

  Returns a reference to the operator object with the given name and type. The desired operator does not need to be active on the stack. If the operator was pushed to the stack during the lifetime of the view, it is registered and the reference to the operator can be returned.

  If the operator is not found, null will be returned. You can always check if the operator is registered by using the `OperatorStack.has` method

  Exmaple usage:

      // Standard Operator
      const standardOperator = view.operators.get(cee.StandardOperator.OPERATOR_ENUM);

      // Custom User-Provided Operator
      const myCustomOperator = view.operators.get(MyCustomOperatorName) as MyCustomOperator;
      const myCustomOperator = view.operators.get<MyCustomOperator>(MyCustomOperatorName);

      // Generic Operator
      const generic = view.operators.get("MyOperatorName");  // Returns Operator type w/o cast

  Return type: | GetOperatorType <S, T>

### has

`OperatorStack.``has`(operator)

  Arguments: | operator (`string`) – None

  Returns true if the operator has been registered with the operator stack.

  Return type: | boolean

### indexOf

`OperatorStack.``indexOf`(operator)

  Arguments: | operator (`Operator`) – None

  Returns the index of an operator on the stack If the operator is not found on the stack, -1 is returned.

  Return type: | number

### peek

`OperatorStack.``peek`()

  Returns the operator at the top of the stack

  Return type: | Operator

### pop

`OperatorStack.``pop`()

  Removes an operator from the top of the stack

  Return type: | Operator

### push

`OperatorStack.``push`(operator[, setAsHotKeyOperator])

  Arguments: | operator (`Operator`) – None setAsHotKeyOperator (`boolean`) – optional None

  Adds an operator on the stack if it’s not already on the stack

  Return type: | boolean

### remove

`OperatorStack.``remove`(operatorInput)

  Arguments: | operatorInput (`string | Operator`) – None

  Removes an operator from the stack

  Return type: | void

### set

`OperatorStack.``set`(operator, position)

  Arguments: | operator (`Operator`) – None position (`number`) – None

  Sets an operator to the 0 based index position on the stack. If there is already an operator in that position, it is replaced. If the operator is already on the stack, it is moved to the requested position.

  Return type: | boolean

### size

`OperatorStack.``size`()

  Returns the operator stack size

  Return type: | number

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Web in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Web?
What are the latest release notes for HOOPS Envision for Web?
How do I start evaluating HOOPS Envision for Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...