@drasi/signalr-vue
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-alpha • Public • Published

Vue Components for Drasi SignalR

This library provides Vue components for streaming changes from the Drasi SignalR Reaction.

Getting started

Install the package

npm install --save @drasi/signalr-vue

ResultSet Component

The ResultSet component requires an endpoint to the SignalR reaction and a query ID. It will render a copy of it's children for every item in the result set of that query, and keep the data up to date via the SignalR connection.

<ResultSet url="<your signalr endpoint>" queryId="<query name>" :sortBy="item => item.field1">
    <template #default="{ item, index }">
        <span>{{ item.field1 }}</span>
        <span>{{ item.field2 }}</span>
    </template>
</ResultSet>

Basic example

<script setup>
import { ResultSet } from '@drasi/signalr-vue';
</script>

<template>
  <main>
    <table>
      <thead>
        <tr>
          <th>Message ID</th>
          <th>Message From</th>
        </tr>
      </thead>
      <tbody>
        <ResultSet url="http://localhost:8080/hub" queryId="hello-world-from" :sortBy="x => x.MessageFrom">
          <template #default="{ item, index }">
            <tr>              
              <td>{{ item.MessageId }}</td>
              <td>{{ item.MessageFrom }}</td>
            </tr>
          </template>
        </ResultSet>
      </tbody>
    </table>
  </main>
</template>

Readme

Keywords

none

Package Sidebar

Install

npm i @drasi/signalr-vue

Homepage

drasi.io

Weekly Downloads

8

Version

0.1.0-alpha

License

Apache-2.0

Unpacked Size

147 kB

Total Files

8

Last publish

Collaborators

  • danielgerlag-msft
  • ruokun-niu
  • amansinghoriginal