Hello
{"ScriptPreparationCode":null,"TestCases":[{"Name":"ResizeObserver","Code":"let value;\r\nconst observer = new ResizeObserver(entries =\u003E {\r\n\tvalue = entries[0].contentRect.width;\r\n})\r\n\r\nobserver.observe(document.body)\r\n\r\nfor (let i = 500; i \u003C= 1920; i\u002B\u002B) {\r\n\twindow.resizeTo(i, 1000)\r\n}","IsDeferred":false},{"Name":"ResizeObserver polyfill","Code":"class ResizeObserver {\r\n constructor(callback) {\r\n this.observables = [];\r\n this.boundCheck = this.check.bind(this);\r\n this.boundCheck();\r\n this.callback = callback;\r\n }\r\n \r\n observe(el) {\r\n if (this.observables.some((observable) =\u003E observable.el === el)) {\r\n return;\r\n }\r\n const newObservable = {\r\n el: el,\r\n size: {\r\n height: el.clientHeight,\r\n width: el.clientWidth\r\n }\r\n }\r\n this.observables.push(newObservable);\r\n }\r\n \r\n unobserve(el) {\r\n this.observables = this.observables.filter((obj) =\u003E obj.el !== el);\r\n }\r\n \r\n disconnect() {\r\n this.observables = [];\r\n }\r\n \r\n check() {\r\n const changedEntries = this.observables.filter((obj) =\u003E {\r\n const currentHeight = obj.el.clientHeight;\r\n const currentWidth = obj.el.clientWidth;\r\n if (obj.size.height !== currentHeight || obj.size.width !== currentWidth) {\r\n obj.size.height = currentHeight;\r\n obj.size.width = currentWidth;\r\n return true;\r\n }\r\n }).map((obj) =\u003E obj.el);\r\n if (changedEntries.length \u003E 0) {\r\n this.callback(changedEntries);\r\n }\r\n window.requestAnimationFrame(this.boundCheck);\r\n }\r\n}\r\n\r\nlet value;\r\nconst observer = new ResizeObserver(entries =\u003E {\r\n\tvalue = entries[0].contentRect.width;\r\n})\r\n\r\nobserver.observe(document.body)\r\n\r\nfor (let i = 500; i \u003C= 1920; i\u002B\u002B) {\r\n\twindow.resizeTo(i, 1000)\r\n}","IsDeferred":false}]}