Skip to content

Allows you to use global 'serverless' events in JavaScript (Node or Web)

Notifications You must be signed in to change notification settings

Mathieu2301/blast-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blast API

Allows you to use global 'serverless' events in JavaScript (Node or Web)

Installation

npm i blast-api

Examples (Projects using Blast)

Use

(Check test.js file)

First, import Blast lib

const Blast = require('./blast')

Then, init the client

Using an username and a password OR just an unique app token :

const client = new Blast({
  username: 'username_test', // as you want
  password: 'password_test', // as you want
  // OR
  app: 'XXXXXXXXXXXXXX', // as you want
  
  url: 'https://your-blast-server/', // (Optional) Default server is mine
})

Listen to an event

client.on('test', (...data) => {
  console.log(...data)
})

Emit examples

client.emit('test', "It works") // => "It Works"

client.emit('test', "It works", "OMG") // => "It Works OMG"

client.emit('test', {
  message: "It works",
  reaction: "OMG"
}) // => Object {message: "It works", reaction: "OMG"}

Problems

If you have errors in console or unwanted behavior please create an issue here.

About

Allows you to use global 'serverless' events in JavaScript (Node or Web)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published