This repository was archived by the owner on Oct 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
sp component base.dynamicproperty
John Nguyen edited this page Apr 22, 2021
·
2 revisions
Home > @microsoft/sp-component-base > DynamicProperty
Serializable object that simplifies usage of a DynamicProperty.
Signature:
export default class DynamicProperty<TValue> implements IDisposableImplements: IDisposable
This is built for usage in web part properties, and modified through the property pane. Can be initialized with a default callback. Web parts initialize with the render method so if the 3rd party developer does nothing, a change in the DynamicProperty will re-render the web part automatically.
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(provider, callback) | Create a new DynamicProperty object. |
| Property | Modifiers | Type | Description |
|---|---|---|---|
| isDisposed | boolean | Returns true if the dispose() method has been called. Once an object is disposed, it remains in this state permanently. | |
| reference | string | undefined | DynamicDataReference string that the DynamicProperty object points to. The reference is of the form <source>:<property>:<path>. |
| Method | Modifiers | Description |
|---|---|---|
| dispose() | This method is called to permanently dispose the object. | |
| hasDefaultCallback() | Returns true if the object has a default callback. | |
| register(callback) | Registers a callback function for updates on the associated DynamicDataSource. | |
| removeDefaultCallback() | Removes the registration for the default callback. | |
| setReference(reference) | Sets the value of the DynamicProperty to be a reference to a DynamicDynamicSource and property. The reference is of the form <source>:<property>:<path>. |
|
| setValue(value) | Sets a static value in the DynamicProperty. | |
| tryGetSource() | Returns the DynamicDataSource that the DynamicProperty object refers to. Returns undefined if the source doesn't exist. | |
| tryGetValue() | Returns the value of the object. | |
| tryGetValues() | Returns the value of the object. | |
| unregister(callback) | Unregisters a callback function for updates on the associated DynamicDataSource. The callback function must be the same it was registered with. |