Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

panic-client

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

panic-client

Test client for panic-server

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-96.95%
Maintainers
1
Weekly downloads
 
Created
Source

Panic Client

Lightweight client for panic-server

npm Travis branch Gitter npm

Docs

Since this library is just support for panic-server, you can find the majority of the documentation over there.

Installing

Panic-client is hosted on npm, and can be installed by running this in your terminal:

npm install panic-client

If you're not familiar with npm, you can learn more by clicking here, or you can install it by following these instructions.

Usage

Panic-client's API surface area is pretty small, since it's just a small wrapper around socket.io. It consists of one method, server, and two properties, connection and platform.

There are two ways to include it in your code, depending on your environment...

Node.js

// simply import it.
var panic = require('panic-client')

Browser

If you're using panic-server, the server automatically delivers the browser file at the at the port/hostname you configured. By default, it will be 'http://localhost:8080/panic.js'.

If you're not using panic-server, it may be more complicated, depending on your file structure. If you're using webpack, simply include it the same way as you would on Node.js. Otherwise, the browser build is located at root level, named panic.js. Simply point a script tag there, or copy it into your project root...

<script src="node_modules/{path to panic-client}/panic.js"></script>
<script>
	panic; // now exposed as a global variable
</script>

Best practice is to load through panic-server.

<script src="http://localhost:8080/panic.js"></script>

.server(String)

This method attempts to connect to your panic-server host, and allows panic-server to run code on your machine in real-time. Just give it the url.

// This is the default url.
// When connecting from another computer,
// exchange `localhost` with your ip address.
panic.server('http://localhost:8080')

.connection

panic.connection is the websocket opened to panic-server. If you haven't called panic.server() yet, it'll be null.

.platform

The panic.platform object is created by platform.js, and contains information about what environment the code is running on.

Support

If you have questions or ideas, please let us know on our gitter channel :grinning:

Keywords

FAQs

Package last updated on 30 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc