All Projects → Fdom92 → stencil-fetch

Fdom92 / stencil-fetch

Licence: MIT license
Fetch API implementation with Stenciljs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to stencil-fetch

soak-your-brain-elearning-app
An e-learning platform built in python (django)
Stars: ✭ 18 (+0%)
Mutual labels:  fetch-api
fetch
A fetch API polyfill for React Native with text streaming support.
Stars: ✭ 27 (+50%)
Mutual labels:  fetch-api
static-web-apps-gallery-code-samples
A community showcase of projects built with Azure Static Web Apps 🎉 Visit: https://microsoft.github.io/static-web-apps-gallery-code-samples/
Stars: ✭ 96 (+433.33%)
Mutual labels:  stenciljs
pagination-pager
Ember.js Component for Bootstrap 3 pagination & pager components
Stars: ✭ 56 (+211.11%)
Mutual labels:  web-component
simple-switch
Vanilla JS/CSS Switch UI element
Stars: ✭ 18 (+0%)
Mutual labels:  web-component
legible
the cleanest way to make http requests in js / node
Stars: ✭ 49 (+172.22%)
Mutual labels:  fetch-api
vaadin-dialog
High quality web component for modal dialogs. Part of the Vaadin platform.
Stars: ✭ 15 (-16.67%)
Mutual labels:  web-component
paper-countries
Select Dropdown with list of countries with flags and autocomplete
Stars: ✭ 16 (-11.11%)
Mutual labels:  web-component
design-system
The Baloise Design System consists of reusable components and a clearly defined visual style, that can be assembled together to build any number of applications.
Stars: ✭ 40 (+122.22%)
Mutual labels:  stenciljs
databind-js
A powerful and flexible MVC data binding library
Stars: ✭ 16 (-11.11%)
Mutual labels:  web-component
mm-components
Music Markups components
Stars: ✭ 50 (+177.78%)
Mutual labels:  stenciljs
vanilla-js
Projects using pure JavaScript without any external libraries or frameworks
Stars: ✭ 129 (+616.67%)
Mutual labels:  fetch-api
bestfetch
fetch ⭐️caching ⭐️deduplication
Stars: ✭ 44 (+144.44%)
Mutual labels:  fetch-api
bottom-nav
Material Design bottom-nav https://material.io/guidelines/components/bottom-navigation.html
Stars: ✭ 25 (+38.89%)
Mutual labels:  web-component
stencil-ds-react-template
This is an example repo of building plugins.
Stars: ✭ 33 (+83.33%)
Mutual labels:  stenciljs
stencil-shimmer
StencilJS component for adding shimmer UI effect to your applications.
Stars: ✭ 14 (-22.22%)
Mutual labels:  stenciljs
xlayers-lite
🦋 xLayers' viewer as a Web Component 🦋
Stars: ✭ 22 (+22.22%)
Mutual labels:  web-component
web-share-wrapper
A web component that wraps other share elements to replace with a web share button where supported.
Stars: ✭ 18 (+0%)
Mutual labels:  web-component
generator-stencil
Scaffolding tool 🔨 for Stencil js applications
Stars: ✭ 16 (-11.11%)
Mutual labels:  stenciljs
web-component
Lightweight library providing interface for building web components
Stars: ✭ 37 (+105.56%)
Mutual labels:  web-component

Built With Stencil

stencil-fetch

stencil-fetch is a web component built with Stencil that allows you to use the Fetch API.

Getting Started

To try this component:

git clone [email protected]:Fdom92/stencil-fetch.git
cd my-app
git remote rm origin

and run:

npm install
npm start

Using this component

Script tag

  • Put <script src='https://unpkg.com/stencil-fetch@latest/dist/fetch.js'></script> in the head of your index.html
  • Then you can use the component

Node Modules

  • Run npm install stencil-fetch --save
  • Put a script tag similar to this <script src='node_modules/stencil-fetch/dist/fetch.js></script> in the head of your index.html
  • Then you can use the component

In a stencil-starter app

  • Run npm install stencil-fetch --save
  • Add { name: 'stencil-fetch' } to your collections
  • Then you can use the component

Parameters

Attribute Default Description
headers {} Headers for the request
method 'GET' The method for the request (GET, POST...)
url '' The URL to make the request
buttonLabel Fetch The button label

Methods

You can make the request anytime with the method makeRequest like this:

element = document.querySelector('st-fetch');
element.makeRequest();

Events

You can listen for the resolved or error events like:

element = document.querySelector('st-fetch');
element.addEventListener('resolved', function(e){console.log(e);})

And you will see the event on the console after ok or error.

resolved

This event will be emitted when all goes OK

error

This event will be emitted when an error ocurred

Example

After addingthis to your code:

<st-fetch url="https://jsonplaceholder.typicode.com/posts"></st-fetch>

You can do this to make a request and get the event:

element = document.querySelector('st-fetch');
element.addEventListener('resolved', function(event){
    // Do whatever you want with the event
});
element.addEventListener('error', function(event){
    // Do whatever you want with the event
});
element.makeRequest();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].