Introducing @bramus/style-observer, a MutationObserver for CSS.
It allows you to attach JavaScript callbacks to changes in computed values of CSS properties.
🔗 https://www.bram.us/2024/08/31/introducing-bramus-style-observer-a-mutationobserver-for-css/
Version 1.2.0 of @bramus/style-observer got published just now.
Since v1.0.0, two options were added:
- notificationMode: pass all properties or only the changed ones into the callback
- returnFormat: pass only the values or a full object with detailed info into the callback
Here’s an example of the extended return format:
```json
{
"--my-variable":{
"value": "1.0",
"previousValue": "0.0",
"changed": true
}
}
```
https://github.com/bramus/style-observer
Version 1.2.0 of @bramus/style-observer got published just now.
Since v1.0.0, two options were added:
- notificationMode: pass all properties or only the changed ones into the callback
- returnFormat: pass only the values or a full object with detailed info into the callback
Here’s an example of the extended return format: