From b8769260ae46b31f4b98d90d3f82160a6d1d106b Mon Sep 17 00:00:00 2001
From: Eugen Neuber <eugen.neuber@tugraz.at>
Date: Wed, 13 Jan 2021 07:33:48 +0100
Subject: [PATCH] Add some code for an observer

(only a prove of concept)
---
 packages/provider/src/provider.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/packages/provider/src/provider.js b/packages/provider/src/provider.js
index 52eda0ac..014090ee 100644
--- a/packages/provider/src/provider.js
+++ b/packages/provider/src/provider.js
@@ -97,6 +97,25 @@ export class Provider extends HTMLElement {
                 e.stopPropagation();
             }
         }, false);
+
+        // Options for the observer (which mutations to observe)
+        const config = { attributes: true, childList: false, subtree: false };
+
+        // Callback function to execute when mutations are observed
+        const callback = function(mutationsList, observer) {
+            // Use traditional 'for loops' for IE 11
+            for(const mutation of mutationsList) {
+                if (mutation.type === 'attributes') {
+                    console.log('The ' + mutation.attributeName + ' attribute was modified.');
+                }
+            }
+        };
+
+        // Create an observer instance linked to the callback function
+        const observer = new MutationObserver(callback);
+
+        // Start observing the target node for configured mutations
+        observer.observe(this, config);
     }
 
     id() {
-- 
GitLab