Decorate a field to be automatically networked synced
Primitive values are all automatically synced (like string, boolean, number).
For arrays or objects make sure to re-assign them (e.g. this.mySyncField = this.mySyncField) to trigger an update

  • Parameters

    • onFieldChanged: undefined | null | string | FieldChangedCallbackFn = null

      name of a callback function that will be called when the field is changed. You can also pass in a function like so: syncField(myClass.prototype.myFunctionToBeCalled)
      Note: if you return false from this function you'll prevent the field from being synced with other clients (for example a networked color is sent as a number and may be converted to a color in the receiver again) Parameters: (newValue, previousValue)

    Returns (target: any, _propertyKey: string | { name: string }) => void

MMNEPVFCICPMFPCPTTAAATR