Track whether object changed

前端 未结 5 455
感情败类
感情败类 2021-01-12 23:33
// A simple Javascript Object / String
var object = \"hello\";

// Imagine a button in the DOM, and if it\'s clicked the object value will change
document.getElement         


        
5条回答
  •  旧巷少年郎
    2021-01-13 00:37

    Recent Google Chrome versions (ex. beta with "Enable Experimental JavaScript" flag on) support Object.observe() API. More info at RESPOND TO CHANGE WITH OBJECT.OBSERVE and working example

提交回复
热议问题