@advanced-rest-client/payload-parser-mixindeprecated

Payload parser mixin to be impplemented with elements that needs to parse payload data

Usage no npm install needed!

<script type="module">
  import advancedRestClientPayloadParserMixin from 'https://cdn.skypack.dev/@advanced-rest-client/payload-parser-mixin';
</script>

README

Published on NPM

Build Status

Published on webcomponents.org

payload-parser-mixin

A mixin to be implemented to elements that needs to parse request / response body.

Usage

Installation

npm install --save @advanced-rest-client/payload-parser-mixin

In a LitElement

import { LitElement, html } from 'lit-element';
import { PayloadParserMixin } from '@advanced-rest-client/payload-parser-mixin/payload-parser-mixin.js';

class SampleElement extends PayloadParserMixin(LitElement) {
  render() {
    const encoded = this.encodeUrlEncoded('String to URL encode');
    return html`
    <p>Encoded: ${encoded}</p>
    `;
  }
}
customElements.define('sample-element', SampleElement);

In a Polymer 3 element

import { PolymerElement, html } from '@polymer/polymer';
import { PayloadParserMixin } from '@advanced-rest-client/payload-parser-mixin/payload-parser-mixin.js';

class SampleElement extends PayloadParserMixin(PolymerElement) {
  static get template() {
    return html`
    <p>Encoded: [[encoded]]</p>
    `;
  }

  _prepareEncoded(value) {
    this.encoded = this.encodeUrlEncoded(value);
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/payload-parser-mixin
cd payload-parser-mixin
npm install

Running the demo locally

npm start

Running the tests

npm test

API components

This components is a part of API components ecosystem