1const registerScEventListeners = () => { 2 const widget = document.getElementById('supportingcast-widget'); 3 if (!widget) { 4 return; 5 } 6 7 widget.addEventListener("sc_widget_login", handleScWidgetLogin); 8 widget.addEventListener("sc_widget_logout", handleScWidgetLogout); 9} 10 11const handleScWidgetLogin = (e) => { 12 // Send the auth token to WP so it can verify the user inside PHP 13 fetch('/wp-json/supportingcast/v1/handle_widget_login', { 14 method: 'POST', 15 body: JSON.stringify({ 16 authToken: e.detail.authToken, 17 loginToken: e.detail.loginToken 18 }) 19 }); 20} 21 22const handleScWidgetLogout = async () => { 23 // Clear the auth token in WP 24 fetch('/wp-json/supportingcast/v1/handle_widget_logout', { 25 method: 'POST', 26 }); 27} 28 29window.addEventListener('load', function() { 30 registerScEventListeners(); 31});
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.