Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "trollbox", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "trollbox.js", |
@@ -9,2 +9,4 @@ (function (root) { | ||
var config = null | ||
function Trollbox (config) { | ||
@@ -33,4 +35,13 @@ const scriptId = 'FirebaseScript' | ||
function onLoad (config) { | ||
const user = config.user || 'anon' | ||
function onLoad (_config) { | ||
_config.user = _config.user || 'anon' | ||
if (config) { | ||
config.channel = _config.channel | ||
config.user = _config.user | ||
return false | ||
} else { | ||
config = _config | ||
} | ||
const ref = initFirebase(config) | ||
@@ -41,3 +52,3 @@ renderBox(config.container) | ||
ref.push().set({ | ||
user: user, | ||
user: config.user, | ||
message: message, | ||
@@ -66,17 +77,6 @@ date: (Date.now() / 1e3) | 0 | ||
var ref = null | ||
var app = window.firebase.initializeApp(config.firebase) | ||
var db = app.database() | ||
var ref = db.ref(`trollbox/${channel}`) | ||
if (window.firebaseApp) { | ||
ref = window.firebaseApp.ref | ||
} else { | ||
var app = window.firebase.initializeApp(config.firebase) | ||
var db = app.database() | ||
ref = db.ref(`trollbox/${channel}`) | ||
window.firebaseCache = { | ||
db: db, | ||
ref: ref | ||
} | ||
} | ||
return ref | ||
@@ -83,0 +83,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8194
196