korest

Maps JSON object into knockout observable with bound REST actions.

Usage no npm install needed!

<script type="module">
  import korest from 'https://cdn.skypack.dev/korest';
</script>

README

Built with Grunt Build Status

Deps Status DevDeps Status Dependency Status

korest

Function for knockout.js to map plain object into knockout observable with bound REST actions. Similar to knockout.mapping, but it is more simple and lightweight.

API

ko.rest(obj, options) - wraps given plain JS object into object with knockout observable fields bound to REST actions. options:

  • url - specifies root url to REST resource.

Wrapper has the following methods.

  • unwrap():Object - unwraps to plain JS object.
  • update(obj):void - updates observable fields with values from given plain JS object.
  • fetch():promise - fetches latest version of object from server.

NPM version Bower version

NPM