You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

blest-vue

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blest-vue

A Vue client for BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.

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

BLEST Vue

A Vue client for BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.

To learn more about BLEST, please visit the website: https://blest.jhunt.dev

Features

  • Built on JSON - Reduce parsing time and overhead
  • Request Batching - Save bandwidth and reduce load times
  • Compact Payloads - Save even more bandwidth
  • Single Endpoint - Reduce complexity and facilitate introspection
  • Fully Encrypted - Improve data privacy

Installation

Install BLEST Vue from npm

With npm:

npm install --save blest-vue

or using yarn:

yarn add blest-vue

Usage

Wrap your app (or just part of it) with BlestProvider.

<template>
  <BlestProvider url='http://localhost:8080' options={{ headers: { Authorization: 'Bearer token' } }}>
    <!-- Your app here -->
  </BlestProvider>
</template>

<script>
import { BlestProvider } from 'blest-vue'
export default {
  data() {
    return {
    };
  },
  mounted() {
  },
  methods: {
  },
};
</script>

Use the blestRequest function to perform passive requests on mount and when parameters change.

<template>
  <div>
    <p v-if="loading">Loading...</p>
    <p v-else-if="error">Error: {{ error.message }}</p>
    <p v-else>{{ JSON.stringify(data) }}</p>
  </div>
</template>

<script>
import { blestRequest } from 'blest-vue'
export default {
  setup() {
    const { data, error, loading } = blestRequest('listItems', { limit: 24 }, { select: ['edges', ['pageInfo', ['endCursor', 'hasNextPage']]] })

    return { data, error, loading }
  }
};
</script>

Use the blestCommand function to generate a request function you can call when needed.

<template>
  <div>
    <!-- Your form here -->
    <button v-on:click="handleSubmit()">Submit</button>
    <p v-if="loading">Loading...</p>
    <p v-else-if="error">Error: {{ error.message }}</p>
    <p v-else>{{ JSON.stringify(data) }}</p>
  </div>
</template>

<script>
import { blestLazyRequest } from 'blest-vue'
export default {
  setup() {
    const [submitForm, { data, loading, error }] = blestLazyRequest('submitForm')

    const handleSubmit = () => {
      submitForm({
        hello: 'World'
      })
    }

    return { handleSubmit, data, loading, error }
  }
};
</script>

License

This project is licensed under the MIT License.

Keywords

blest

FAQs

Package last updated on 27 Dec 2024

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