1/* Shane AI â tiny typed event bus (lib/shane/events). 2 The app's real upload/error/name paths emit here; the character subscribes and 3 reacts in-character. Kept dependency-free and classic-script safe so it can be 4 shipped as a plain <script defer> alongside the marketing pages. SSR-guarded. */ 5(function(){ 6 if(typeof window==='undefined')return; 7 var S=window.Shane=window.Shane||{}; 8 if(S.bus)return; 9 10 // The vocabulary Shane understands. Emitting an unknown type still works but 11 // warns in the console â a cheap typo-guard that keeps the contract honest. 12 var TYPES={ 13 'reserve:success':1, // a name was locked in / waitlist joined / payment cleared 14 'reserve:error':1, // a reserve / waitlist / checkout call failed (network or server) 15 'name:check':1, // an availability check resolved for a handle the visitor typed 16 'chat:message':1 // the visitor sent Shane a chat message 17 }; 18 19 var handlers={}; 20 var last={}; // last payload per type, so a late subscriber can catch up via bus.last() 21 22 S.bus={ 23 TYPES:TYPES, 24 on:function(type,fn){ 25 if(typeof fn!=='function')return function(){}; 26 (handlers[type]||(handlers[type]=[])).push(fn); 27 return function off(){ var a=handlers[type]; if(!a)return; var i=a.indexOf(fn); if(i>-1)a.splice(i,1); }; 28 }, 29 emit:function(type,data){ 30 data=data||{}; 31 if(!TYPES[type]&&window.console&&console.debug)console.debug('[Shane] unknown event:',type); 32 last[type]=data; 33 var a=handlers[type]; if(!a)return; 34 a.slice().forEach(function(fn){ try{ fn(data); }catch(e){} }); 35 }, 36 last:function(type){ return last[type]; } 37 }; 38})();
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.