@appformllc/hubcontroller

0.2.5 • Public • Published

JavaScript client for AppForm.HubController for ASP.NET Core

Installation

npm install @appformllc/hubcontroller

Usage

See the AppForm.HubController Documentation.

Browser

To use the client in a browser, copy *.js files from the dist/browser folder to your script folder include on your page using the <script> tag. This should be added after including the base @aspnet/signalr browser script.

Webpack

To use the client in a NodeJS application, install the package to your node_modules folder and use import '@appformllc/hubcontroller' to load the module. This should be called after calling import { HubConnectionBuilder } from '@aspnet/signalr' to include the base client.

Example (Browser)

var connection = new signalR.HubConnectionBuilder()
    .withUrl("/chat")
    .build();

...

connection.execute('demo/getNames')
  .then(result => {
    console.log('success!', result);
  })
  .catch(error => {
    console.error('uh oh!', error);
  });

connection.execute('demo/findName', 'John Doe')
  .then(result => {
    console.log('success!', result);
  })
  .catch(error => {
    console.error('uh oh!', error);
  });

Example (Webpack)

import { HubConnectionBuilder } from '@aspnet/signalr';
import '@appformllc/hubcontroller'

let connection = new HubConnectionBuilder()
    .withUrl("/chat")
    .build();

...

connection.execute('demo/getNames')
  .then(result => {
    console.log('success!', result);
  })
  .catch(error => {
    console.error('uh oh!', error);
  });

connection.execute('demo/findName', 'John Doe')
  .then(result => {
    console.log('success!', result);
  })
  .catch(error => {
    console.error('uh oh!', error);
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @appformllc/hubcontroller

Weekly Downloads

3

Version

0.2.5

License

Apache-2.0

Unpacked Size

13.8 kB

Total Files

8

Last publish

Collaborators

  • jliddell