0.0.1 • Published 3 years ago

pelte-opt-kit v0.0.1

Weekly downloads
7
License
-
Repository
-
Last release
3 years ago

pelte-opt-kit

pelte-opt-kit is a vanilla javascript component which will work in any frontend framework. You can install from npm like this:

npm install --save pelte-opt-kit

Usage: Javascript (assumes es module)

import OptKit from 'pelte-opt-kit'

let optKit = new OptKit({target:document.body);
 

The "target" is where the component is created. Here it is added to the html body with "document.body", but it could also be document.getElementById('id-of-html-element').

You initialize properties with "props" and you can change the prop values by just assigning the props to new values - this will be updated in the UI.

Usage: Legacy Javascript

Below you can see how to use the component with vanilla js.

...
<head>
  ...
  <script src="https://unpkg.com/pelte-opt-kit@0.0.1/index.js"></script>
</head>
<body>
  <script>
    let optKit = new OptKit({target:document.body})
  </script>
</body>

Usage: Web Component (aka. Custom Element)

You can use it as a web component.

<head>
  <script src="https://unpkg.com/pelte-opt-kit@0.0.1/index.js"></script>
</head>
<body>
  <name-of-ce  />    
</body>

WARNING: The author of the component needs to add <svelte:options tag="name-of-ce"/>.

Svelte Component

<script>
  import OptKit from 'pelte-opt-kit';
</script>
<OptKit/>

Pelte

This component was created by pelte (aka publish-svelte)