Module for initializing knockout observables
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
lib
.babelrc
.eslintrc
.gitignore
LICENSE
README.md
package.json
rollup.config.js

README.md

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);