使用变异观察者作为多对象参数

问题描述

代码将一直起作用,直到active_observers中包含三个元素,我做错了吗?`

var active_observers = {};
var observer = new MutationObserver((mutations) => {
         if (mutations[0].attributeName === 'class') {                 
              active_observers[user_name].speak_counter += 1;
              var name_positive =`speaking:${user_name}\t` +  
              active_observers[user_name].positive_marks;
              console.log(name_positive) 
        // Sending a message to display the speaker's name in the popup,message includes a trailing space
             chrome.runtime.sendMessage({ todo: name_positive,speakerId: user_name });
                    }
                });
observer.observe(user_mic,{ attributes: true });
active_observers[user_name] = {
       "user_name": user_name,"speak_counter": 0,"user_observer": observer,"positive_marks": 0
                    };
            

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)