%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
class fbase{ constructor(){ this.config = { apiKey: "AIzaSyB3MzMtLvuKPlv2jYVOEHvoXxLLqyLogPI", authDomain: "test-project-110a5.firebaseapp.com", databaseURL: "https://test-project-110a5.firebaseio.com", projectId: "test-project-110a5", storageBucket: "test-project-110a5.appspot.com", messagingSenderId: "849429740281", appId: "1:849429740281:web:8eae0607b3c34f85f50028", measurementId: "G-Z3MBKGNRCW" }; if(!firebase.apps.length){ firebase.initializeApp(this.config); } this.auth=firebase.auth; this.db=firebase.database(); this.refName=location.href.indexOf("localhost")>=0?'dilms':'pilms'; } signup=(email, password)=>{ return this.auth().createUserWithEmailAndPassword(email, password); } signin=(email, password)=>{ return this.auth().signInWithEmailAndPassword(email, password); } onNewMsg=(ref, callback, limit)=>{ limit=limit || 1; let dbref=this.db.ref(ref); dbref.limitToLast(limit).on("value", snapshot=>{ let msgs=[]; snapshot.forEach((snap)=>{ msgs.push(snap.val()); }); if(callback){ callback(msgs); } }); return dbref; } allMsg=(ref, callback, limit)=>{ limit=limit || 1000; let dbref=this.db.ref(ref); dbref.limitToLast(limit).once("value", snapshot=>{ let msgs=[]; snapshot.forEach((snap)=>{ msgs.push(snap.val()); }); if(callback){ callback(msgs); } }); return dbref; } sendMsg=(ref, msg, errCallback)=>{ try { this.db.ref(ref).push(msg); }catch(error){ if(errCallback){ errCallback(error); } } } offRefValue=(ref)=>{ if(!ref){ return; } try{ ref.off("value"); }catch(e){ } } offRef=(ref)=>{ try{ this.db.ref(ref).off(); }catch(e){ } } offDb=()=>{ try{ this.db.off(); }catch(e){ } } defaultSignIn=async()=>{ if(!this.isLogged()){ await this.signin("test1@test.com", "123456"); onNewNotification(); }else{ onNewNotification(); } } isLogged=()=>{ //let fbaseLogged=window.sessionStorage['fbaseLogged'] || ''; //return fbaseLogged==='Y'?1:0; return this.auth().currentUser?true:false } } fbaseOb=new fbase(); fbaseOb.defaultSignIn();