{"ScriptPreparationCode":"class PubSub {\r\n constructor() {\r\n this.events = {};\r\n }\r\n\r\n\r\n subscribe(event, callback) {\r\n if (!this.events.hasOwnProperty(event)) {\r\n this.events[event] = [];\r\n }\r\n\r\n return this.events[event].push(callback);\r\n }\r\n\r\n publish(event, data = {}) {\r\n if (!this.events.hasOwnProperty(event)) {\r\n return [];\r\n }\r\n\r\n return this.events[event].map((callback) =\u003E callback(data));\r\n }\r\n}\r\n","TestCases":[{"Name":"Custom Event","Code":"let i = 1001;\r\nconst results = [];\r\nwhile (--i) {\r\n window.dispatchEvent(new CustomEvent(\u0027custom:test\u0027));\r\n}\r\n\r\n","IsDeferred":false},{"Name":"PubSub","Code":"class PubSub {\r\n constructor() {\r\n this.events = {};\r\n }\r\n\r\n\r\n subscribe(event, callback) {\r\n if (!this.events.hasOwnProperty(event)) {\r\n this.events[event] = [];\r\n }\r\n\r\n return this.events[event].push(callback);\r\n }\r\n\r\n publish(event, data = {}) {\r\n if (!this.events.hasOwnProperty(event)) {\r\n return [];\r\n }\r\n\r\n return this.events[event].map((callback) =\u003E callback(data));\r\n }\r\n}\r\nconst pubSub = new PubSub();\r\nlet i = 1001;\r\nconst results = [];\r\nwhile (--i) {\r\n pubSub.publish(\u0027custom\u0027, \u0027test\u0027)\r\n}","IsDeferred":false}]}