🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@ezraobiwale/dpd

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ezraobiwale/dpd

A Deployd frontend library

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

dpd

A Deployd frontend library

Installation

npm i @ezraobiwale/dpd

or

yarn add @ezraobiwale/dpd

Usage

This library allows you to decide which http and socket transports to use.

import dpd from '@ezraobiwale/dpd'

const server = dpd(httpTransport[, socketTransport])

Important Note

The httpTransport must have a request method that takes a single object parameter:

request({
  method, // get | post | put | delete
  url, // the request url
  data // An object representing the data being sent
})

Http

  • Http
  • Axios

Socket

Http Usage

const collection = server.col('collection-name')

The collection object has methods get, post, put, del and exec.

get

collection.get({ $sort: { name: 1 } }) // get a list

collection.get('abcd1234') // get an item

post

collection.post({ name: 'John Doe' }) // creates new item

put

collection.put({ name: 'Jane Doe' }) // updates an item

del

collection.del('abcd1234') // deletes an item

**Note**

The response is always the returned value of the `request` method of the http transport.

### Socket Usage

Methods include `on`, `once`, `off` and `emit`:

#### on

```javascript
server.on('create', (/*...*/) => {
  // do something
})

once

server.once('create', (/*...*/) => {
  // do something
})

off

server.off('create', (/*...*/) => {
  // do something
})

emit

server.emit('notify', { /*...*/ })

Vue Usage

import Vue from 'vue'
import { VueInstaller } from '@ezraobiwale/dpd'

Vue.use(VueInstaller, httpTransport [, socketTransport])

You can then access dpd as this.$dpd.

FAQs

Package last updated on 25 Oct 2019

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