1/** 2 * Due to locker service restrictions, we can not access a documents cookies within a component. We can include this script in our 3 * communities head to serve as a broker for getting cookies from the dom. we cna fire the 'componentConnected' custom event and 4 * capture it in this script. We can then get the cookies from the document and create the documentCookies custom event and fire it. 5 * This event can be captured by the component for processing. 6 */ 7window.addEventListener("componentConnected", function(e) { 8 let cookies = document.cookie; 9 let event = new CustomEvent("documentCookies", { detail: cookies }); 10 window.dispatchEvent(event); 11}); 12 13window.addEventListener("deleteCookies", function(e) { 14 let cookies = e.detail; 15 for (let i = 0, len = cookies.length; i < len; i++) { 16 let cookieWithStandardPath = cookies[i] + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;"; 17 let cookieWithCommunityPath = cookies[i] + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/s;"; 18 document.cookie = cookieWithStandardPath; 19 document.cookie = cookieWithCommunityPath; 20 } 21});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.