• 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

    • Optional onFieldChanged: string | FieldChangedCallbackFn

      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)
      This function may return false to prevent notifyChanged from being called (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, _propertyKey) => void)

      • (target, _propertyKey): void
      • Parameters

        • target: any
        • _propertyKey: string | {
              name: string;
          }

        Returns void

Generated using TypeDoc