koutils
v2.0.2
Published
Knockout Utilities Extensions to simplify Knockout app development
Downloads
4
Maintainers
Readme
KoUtils
Knockout Utilities Extensions to simplify Knockout app development.
Installation
Using Bower:
$ bower install koutils --save
Using NPM:
$ npm install koutils --save
Using NuGet:
$ Install-Package KoUtils
Usage
You could use koutils in different context.
Browser (AMD)
First configure Require.JS:
requirejs.config({
paths: {
knockout: 'path/to/knockout',
koutils: 'path/to/koutils'
}
});
Then load modules independently
define(["koutils/changetracker"], function(ChangeTracker) {
var obs = ko.observable(),
tracker = new ChangeTracker(obs);
tracker.hasChanges(); // false
obs("newValue");
tracker.hasChanges(); // true
});
Or load koutils entirely (not recommended):
define(["koutils"], function(koutils) {
var obs = ko.observable(),
tracker = new koutils.ChangeTracker(obs);
tracker.hasChanges(); // false
obs("newValue");
tracker.hasChanges(); // true
});
Browser / Node (CommonJS)
Import modules independently in the Node.js way:
var ko = require("knockout");
var ChangeTracker = require("koutils/changetracker");
var obs = ko.observable(),
tracker = new ChangeTracker(obs);
tracker.hasChanges(); // false
obs("newValue");
tracker.hasChanges(); // true
Or load koutils entirely (not recommended in browser);
var ko = require("knockout");
var koutils = require("koutils");
var obs = ko.observable(),
tracker = new koutils.ChangeTracker(obs);
tracker.hasChanges(); // false
obs("newValue");
tracker.hasChanges(); // true
Documentation
Documentation is hosted on Github Wiki