# Interface PropertyValuesEmitter

The PropertyValues mechanism provides a means for passing configuration type values between different components running in the server process such as plugins and input connections.

A plugin can both emit values and listen for values emitted by others.

The difference between the PropertyValues mechanism and Event Emitters in NodeJs is that when `onPropertyValues` is called, the `callback()` function will be invoked and passed an array containing all of the previous values for that property name, starting with the initial value of `undefined`. If no values have been emitted for that property name the callback will be invoked with a value of `undefined`. * PropertyValue has the following structure:

    interface PropertyValue {
      timestamp: number // millis
      setter: string // plugin id, server, provider id
      name: string
      value: any
    }

Note that the value can be also a function.

This mechanism allows plugins to offer extensions via "Well Known Properties", for example

- additional NMEA0183 sentence parsers for custom sentences via `nmea0183sentenceParser`
- additional PGN definitions for propietary or custom PGNs

Code handling incoming PropertyValues should be fully reactive due to:

- Plugins being able to emit PropertyValues when they activated and / or started
- There being no defined load / startup order for plugins / connections.

So even if all plugins / connections emit during their startup, you cannot depend on a specific PropertyValue being available. It may be present when your code starts or it may arrive after your code has started.

Note: The PropertyValues mechanism is not intended to be used for data passing on a regular basis, as the total history makes it a potential memory leak.

To safeguard against a component accidentally emitting regularly, via a fixed upper bound is enforced for the value array per property name. New values will be ignored if the upper bound is reached and are logged as errors.

interface PropertyValuesEmitter {
emitPropertyValue(name: string, value: unknown): void;
onPropertyValues(name: string, cb: PropertyValuesCallback): () => void;
}

#### Hierarchy

- PropertyValuesEmitter
  - ServerAPI

- Defined in propertyvalues.ts:38

##### Index

### Property Values

emitPropertyValue
onPropertyValues

## Property Values

### emitPropertyValue

- emitPropertyValue(name: string, value: unknown): void

  Emit a property value that can be received by listeners.

  #### Parameters

  - name: string

    The property name identifier

  - value: unknown

    The value to emit (can be any type including functions)

  #### Returns void

  - Defined in propertyvalues.ts:45

### onPropertyValues

- onPropertyValues(name: string, cb: PropertyValuesCallback): () => void

  #### Parameters

  - name: string
  - cb: PropertyValuesCallback

  #### Returns () => void

  - Defined in propertyvalues.ts:50