IUniverSpreadsheetListener
Univer Listener. A listener gets automatically the value of one cell every time its value has changed
public interface IUniverSpreadsheetListener
Remarks
This interface defines a contract for spreadsheet listeners that react to changes in individual cell values. It manages the lifecycle and interaction of listeners via JavaScript interop.
Any Scoped service that manage Spreadsheet Listeners must use this contract in order to work correctly in the Javascript environment.
Properties
Property | Type | Description |
---|---|---|
Listeners | Dictionary<UniverSpreadsheetListenerData, Action | All active Listeners |
Methods
InitializeListenersAsync
void InitializeListenersAsync()
Init the dictionary and the relation in the JSInterop
AddListenerAsync
void AddListenerAsync(UniverSpreadsheetListenerData data, Action<object> _event)
Adds a new listener to the array
Parameters
Parameter | Type | Description |
---|---|---|
data | UniverSpreadsheetListenerData | Data to locate the listener in the workbook |
_event | Action<object> | Triggers when the cell in the listener change its value |
RemoveListenerAsync
void RemoveListenerAsync(UniverSpreadsheetListenerData data)
Removes the specified listener in the array
Parameters
Parameter | Type | Description |
---|---|---|
data | UniverSpreadsheetListenerData | Item to delete |
GetListeners
UniverSpreadsheetListenerData[] GetListeners()
Returns all active listeners
Returns
UniverSpreadsheetListenerData[]: Array of all currently active listeners
OnDataChanged
void OnDataChanged(UniverSpreadsheetListenerData data, object value)
JSInvokable: Event for the Manager to trigger the listener, depending the cell that was value changed
Parameters
Parameter | Type | Description |
---|---|---|
data | UniverSpreadsheetListenerData | Data Listener |
value | object | Value obtained |