new ReactiveProperty(defaultValue)
You can call the constructor without any parameters, the default value of the property is null. If you provide a single parameter then this value is taken as default value.
Parameters:
Name | Type | Description |
---|---|---|
defaultValue |
* | (optional) default value of the property |
- Source:
Example
Constructing Reactive Properties
If you don't specify any default value on creation of the property then the default value will be set to null. Otherwise you can provide a single parameter as default value. Setting and getting the property is straight forward as in any other system.// no defeault value defined var reactiveProperty = new ReactiveProperty(); reactiveProperty.get(); // will return null // with default value var reactiveProperty = new ReactiveProperty("test"); reactiveProperty.get(); // will return "test"
Methods
-
get() → {*}
-
Returns the value of the reactive property and makes the current computation depend on this property via the Meteor dependency system.
- Source:
Returns:
- Type
- *
-
set(value) → {undefined}
-
Sets the value of the reactive property and invalidates all Meteor computations that depend on this property.
Parameters:
Name Type Description value
* the new value of the property
- Source:
Returns:
- Type
- undefined