knockout-init

1.0.0 • Public • Published

knockout-init

Module for initializing knockout observables.

Usage

<div data-bind="init: { key: foo, value: 'bar' }"></div>
var foo = ko.observable(null);
foo.subscribe(function (val) {
  // val === "bar" --> true
});

Installation

This is how I use it with a Webpack bundled project. Your setup may be different.

$ npm install knockout-init --save-dev
import ko from "knockout";
import init from "knockout-init";
 
ko.bindingHandlers.init = init(ko);

Package Sidebar

Install

npm i knockout-init

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • mshick