@rhtml/graphql
TypeScript icon, indicating that this package has built-in type declarations

0.0.134 • Public • Published

@rhtml/graphql

Installation

npm i @rhtml/graphql

Usage

import { LitElement, Component, html } from '@rxdi/lit-html';
import { BehaviorSubject } from 'rxjs';
import { delay } from 'rxjs/operators';

import '@rhtml/components';
import '@rhtml/operators';
import '@rhtml/graphql';

interface State { counter: number }

@Component({
  selector: 'r-html-view',
  template(this: RHtmlViewComponent) {
    return html`
      <r-part>
        <r-settings .value=${{ fetchPolicy: 'cache-first' }}></r-settings>
        <r-fetch query="{
          continents {
            name
          }
        }"></r-fetch>
        <r-render .state=${({ data: { continents } }: IQueryData) => html`
          <r-for .of=${continents}>
            <r-let .item=${({ name }: IContinent) => name}></r-let>
          </r-for>
        `}>
        </r-render>
      </r-part>

      <r-part>
        <!-- <r-state .value=${interval(1000).pipe(map(i => ({ data: { notifications: { appUpdated: i } } })))}></r-state> -->
        <r-fetch .subscribe=${`{ notifications { appUpdated } }`}></r-fetch>
        <r-render .state=${(
            { data: { notifications: { appUpdated } }}: NotificationState,
            setState: (s: NotificationState) => void
          ) => html`
            <p>${appUpdated}</p>
            <button
              @click=${() => {
                setState({
                  data: {
                    notifications: {
                      appUpdated: Number(appUpdated) + Number(appUpdated)
                    }
                  }
                });
              }}
            >
              Increment Subscriptions State x2
            </button>
            (will be overriten when server emit new state)
          `}
        >
        </r-render>
      </r-part>
    `;
  }
})
export class RHtmlViewComponent extends LitElement {}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.1340latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.1340
0.0.1330
0.0.1320
0.0.1310
0.0.1300
0.0.1290
0.0.1280
0.0.1270
0.0.1260
0.0.1250
0.0.1240
0.0.1230
0.0.1220
0.0.1210
0.0.1200
0.0.1190
0.0.1180
0.0.1170
0.0.1160
0.0.1150
0.0.1140
0.0.1130
0.0.1120
0.0.1110
0.0.1100
0.0.1090
0.0.1080
0.0.1070
0.0.1060
0.0.1050
0.0.1040
0.0.1030
0.0.1020
0.0.1010
0.0.1000
0.0.990
0.0.980
0.0.970
0.0.960
0.0.950
0.0.940
0.0.930
0.0.920
0.0.910
0.0.900
0.0.890
0.0.880
0.0.870
0.0.860
0.0.850
0.0.840
0.0.830
0.0.820
0.0.810
0.0.800
0.0.790
0.0.780
0.0.770
0.0.760
0.0.750
0.0.740
0.0.730
0.0.720
0.0.710
0.0.700
0.0.690
0.0.680
0.0.670
0.0.660
0.0.650
0.0.640
0.0.630
0.0.620
0.0.610
0.0.600
0.0.590
0.0.580
0.0.570
0.0.550
0.0.470
0.0.460
0.0.450
0.0.440
0.0.430
0.0.420
0.0.410
0.0.400
0.0.390
0.0.380
0.0.370
0.0.360
0.0.350
0.0.340
0.0.330
0.0.320
0.0.310
0.0.300
0.0.290
0.0.280
0.0.270
0.0.260
0.0.250
0.0.240
0.0.230
0.0.220
0.0.210
0.0.200
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @rhtml/graphql

Weekly Downloads

0

Version

0.0.134

License

MIT

Unpacked Size

39.6 kB

Total Files

34

Last publish

Collaborators

  • rxdi