koutils
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

# KoUtils Build Status Bower version NuGet version npm version

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

Dependents (0)

Package Sidebar

Install

npm i koutils

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

40.2 kB

Total Files

27

Last publish

Collaborators

  • mluce