0.0.20 • Published 7 years ago

trollbox v0.0.20

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

trollbox

Instant trollbox using Firebase.

Demo

https://lab.miguelmota.com/trollbox

Install

npm install trollbox

Instructions

  1. Create a new Firebase project.

  2. Set read/write rules to be global in Firebase.

Firebase dashboard console -> Database -> Rules

{
  "rules": {
    ".read": true,
    ".write": true
  }
}
  1. Set up HTML container:
<div id="trollbox"></div>
  1. Copy Firebase project config from dashboard and initialize trollbox:
const Trollbox = require('trollbox')

const config = {
  // DOM selector for trollbox
  container: '#trollbox',

  // Firebase project config found in dashboard
  firebase: {
    apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    authDomain: 'xxxxxxxx-xxxxx.firebaseapp.com',
    databaseURL: 'https://xxxxxxxx-xxxxx.firebaseio.com',
    projectId: 'xxxxxxxx-xxxxx',
    storageBucket: 'xxxxxxxx-xxxxx.appspot.com',
    messagingSenderId: 'xxxxxxxxxxxx'
  },

  // trollbox channel name (chat room)
  channel: 'global',

  // trollbox username
  user: 'anon'
}

const trollbox = new Trollbox(config)
  1. Copy base trollbox.css stylesheet into your web app.

  2. That's it!

Later on if you need to, you can change the channel name and user:

trollbox.setChannel('random')
trollbox.setUser('Bob')

You can also completely destroy the trollbox:

trollbox.destroy()

License

MIT

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago