@sewjs/core

SewJs Core

Usage no npm install needed!

<script type="module">
  import sewjsCore from 'https://cdn.skypack.dev/@sewjs/core';
</script>

README

SewJs

Installation

npm install @sewjs/core

Usage

NPM

const SewJs = require('@sewjs/core');

- or -

In Browser

<script src="https://unpkg.com/@sewjs/core"></script>

API reference

Initializing

var sewjs = new SewJs();

Getter

sewjs.variable

Setter

sewjs.variable = value

Link

var dummyObject = {};
sewjs.link('variable',
dummyObject, /* parent object */
'newVariable', /* variable in parent object */
/* transform value function returning the new value (optional) */);

- or -

var dummyObject = {};
sewjs.link('variable',
 /* callback */
function(value) {
    this.classList.add(value)
},
document.querySelector('body'), /* destination  (optional) */
/* transform value function returning the new value (optional) */);

Unlink

var dummyObject = {};
sewjs.unlink('variable',
dummyObject, /* parent object (optional) */
'newVariable' /* variable in parent object (optional) */);

- or -

var dummyObject = {};
sewjs.unlink('variable',
 /* callback (optional) */
function(value) {
    this.classList.add(value)
},
document.querySelector('body') /* destination (optional) */);