get-set

Set, get, on, trigger. My basic model toolkit.

Usage no npm install needed!

<script type="module">
  import getSet from 'https://cdn.skypack.dev/get-set';
</script>

README

getSet

For small projects that don't necessitate a framework solution, I often want to reach into the backbone.js toolkit. getSet provides that minimal kit: events (on, trigger), get, and set.

Usage


//Define your constructor
var MyModel = function() {};

MyModel.prototpe = new GetSet();

//Now define the rest of your model...
MyModel.prototype...

API

on(name, fn)
trigger(name, arg1, arg2 /* , ... */)
get(key)
set(key,val);
set(object); //Object of key-val pairs