You can use the `
monday.listen` software development kit (SDK) method to create a listener that allows subscribing to certain types of client-side events.
|typeOrTypes||The type, or array of types, of events to subscribe to.|
|callback||A callback function that is fired when the listener is triggered by a client-side event.|
|params||Reserved for future use.|
You can subscribe to the following types of events:
|context||Fired when one of the parameters in the context changes.|
|settings||Fired when a setting value is changed by the user.|
|itemIds||Fired when the board filter changes, which impacts the list of items currently in view.|
|events||Fired when an interaction takes place with the board/dashboard. We support the following events: `|
|filter||Fired when the Search filter changes.|
|location||Fired when the location value changes.|
This method does not have a return value.
### Add settings to your views and widgets
Every view or widget in monday.com has a set of fields that lets a user customize that view or widget. Our apps framework allows you to add these fields to your custom views and widgets, and then your app can access the values that the user has configured via our SDK.
For example, the Timeline allows users to choose which columns are displayed, and the Chart lets users change the X axis and chart type. You can use any of the 12 fields we support.
To do this, first add a settings field to your feature to get the color value as an input. Then, we'll use the monday SDK to retrieve this setting's value and use it in our view or widget.
Here's a snippet that listens for changes and calls a callback when the settings field is changed by the user:
### Subscribe to changes in settings and context
### Listen to changes in your app's context
### Subscribe to interaction-based events on the board
### Retrieve the search query in your app
You can also retrieve the entire search query string in your app. With this approach, you can retrieve the search query the user has entered in their board.
You can use either `
monday.listen('filter')` or `
monday.get('filter')` to return the search term(s).
The following example retrieves the search query string:
### Filter your app's data based on the board filter
The SDK lets your app check if the user has filtered any items on their boards. With this approach, you can add flexibility to your app and create a unified experience for your users.
By using `
monday.listen("itemIds", callback)`, you can get a list of items that are displayed on the board.
The following example sets up a listener when the user filters data on the board:
### Listen to the URL location within an app
The SDK allows you to listen to an app's location when a user modifies it. You can also use the `
monday.get("location")` <a href="https://developer.monday.com/apps/docs/mondayget#getting-the-url-location-within-an-app" target="_blank">SDK method</a> to get the location.
Join our developer community!
We've created a <a href="https://community.monday.com/c/developers/8" target="_blank"> community</a> specifically for our devs where you can search through previous topics to find solutions, ask new questions, hear about new features and updates, and learn tips and tricks from other devs. Come join in on the fun! 😎