@advanced-rest-client/payload-parser-mixin
v3.0.1
Published
Payload parser mixin to be implemented with elements that needs to parse payload data
Downloads
1,728
Readme
payload-parser-mixin
A mixin to be implemented to elements that needs to parse request / response body.
This component is no longer developed. Please, do not use it.
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