• Stars
    star
    1,054
  • Rank 43,744 (Top 0.9 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 13 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Knockback.js provides Knockout.js magic for Backbone.js Models and Collections.

Build Status

logo

Knockback.js provides Knockout.js magic for Backbone.js Models and Collections.

Why Knockback?

  • Make amazingly dynamic applications by applying a small number of simple principles
  • Leverage the wonderful work from both the Backbone and Knockout communities
  • Easily view and edit relationships between Models using an ORM of your choice:
  • Simplify program control flow by configuring your application from your HTML Views. It's like Angular.js but without memorizing all of the special purpose ng-{something} attributes. See the Inject Tutorial for live examples!

Examples

Simple

The HTML:
<label>First Name: </label
><input data-bind="value: first_name, valueUpdate: 'keyup'" />
<label>Last Name: </label
><input data-bind="value: last_name, valueUpdate: 'keyup'" />
And...engage:
model = new Backbone.Model({first_name: 'Bob', last_name: 'Smith'})
ko.applyBindings(kb.viewModel(model))

When you type in the input boxes, the values are properly transferred bi-directionally to the model and all other bound view models!

Advanced

The View Model:

Javascript

var ContactViewModel = kb.ViewModel.extend({
  constructor: function(model) {
    kb.ViewModel.prototype.constructor.call(this, model);

    this.full_name = ko.computed(function() {
      return this.first_name() + " " + this.last_name();
    }, this);
});

or Coffeescript

class ContactViewModel extends kb.ViewModel
  constructor: (model) ->
    super model

    @full_name = ko.computed => "#{@first_name()} #{@last_name()}"
The HTML:
<h1 data-bind="text: 'Hello ' + full_name()"></h1>
<label>First Name: </label
><input data-bind="value: first_name, valueUpdate: 'keyup'" />
<label>Last Name: </label
><input data-bind="value: last_name, valueUpdate: 'keyup'" />
And...engage:
model = new Backbone.Model({first_name: 'Bob', last_name: 'Smith'})
view_model = new ContactViewModel(model)
ko.applyBindings(view_model)

# ... do stuff then clean up
kb.release(view_model)

Now, the greeting updates as you type!

Getting Started

Download Latest (1.2.3):

Please see the release notes for upgrade pointers.

The full versions bundle advanced features.

The core versions remove advanced features that can be included separately: localization, formatting, triggering, defaults, and validation.

The stack versions provide Underscore.js + Backbone.js + Knockout.js + Knockback.js in a single file.

###Distributions

You can also find Knockback on your favorite distributions:

  • npm: npm install knockback
  • Bower: bower install knockback
  • NuGet - install right in Visual Studio

###Dependencies

  • Backbone.js - provides the Model layer
  • Knockout.js - provides the ViewModel layer foundations for Knockback
  • Underscore.js - provides an awesome JavaScript utility belt
  • LoDash - optionally replaces Underscore.js with a library optimized for consistent performance
  • Parse - optionally replaces Backbone.js and Underscore.js

###Compatible Components

  • BackboneORM - A polystore ORM for Node.js and the browser
  • Backbone-Relational.js - Get and set relations (one-to-one, one-to-many, many-to-one) for Backbone models
  • Backbone Associations - Create object hierarchies with Backbone models. Respond to hierarchy changes using regular Backbone events
  • BackboneModelRef.js - provides a reference to a Backbone.Model that can be bound to your view before the model is loaded from the server (along with relevant load state notifications).

Contributing

To build the library for Node.js and browsers:

$ gulp build

Please run tests before submitting a pull request:

$ gulp test --quick

and eventually all tests:

$ npm test

More Repositories

1

_.m

_.m is a port of Underscore.js to Objective-C.
Objective-C
151
star
2

mixin

Mixin.js is the 'reuse more' Javascript nano-framework. Stay DRY...mixin!
CoffeeScript
80
star
3

background

CoffeeScript / JavaScript background job / task / worker library. Provides implementations for jobs, a job queue, a job list, and single and multiple array iterators.
CoffeeScript
67
star
4

backbone-modelref

Backbone-ModelRef.js provides a mechanism to respond to lazy-loaded Backbone.js models.
CoffeeScript
56
star
5

SubjectiveScript.m

Subjective-Script makes Objective-C more scripty!
Objective-C
45
star
6

json-serialize

JSON-Serialize.js provides conventions and helpers to manage serialization and deserialization of instances to/from JSON
CoffeeScript
34
star
7

underscore-awesomer

Awesome add-ons for Underscore.js.
JavaScript
29
star
8

phonegap-couchbase-xplatform

A starting place for creation a cross-platform PhoneGap reference project using Couchbase
JavaScript
26
star
9

knockback-navigators

KnockbackNavigators.js provides page navigators, a pane navigator, and transition animations to help you make dynamic, single-page applications. They are platform-agnostic so you can even use them without using Knockback.js or Knockout.js!
JavaScript
24
star
10

backbone-articulation

Add custom attribute serialization and deserialization to your Backbone.Models.
CoffeeScript
23
star
11

easy-bake

EasyBake enables CoffeeScript/JavaScript file-based configuration for your CoffeeScript library management needs (coffee compiling, compression, joining CoffeeScript + JavaScript files, headless testing for QUnit/Jasmine/NodeUnit, client/server version testing, etc).
CoffeeScript
16
star
12

tensorflow-node

Tensorflow for node.js
C++
15
star
13

esbuild-plugin-dev-server

Dev server for esbuild with live reload and error overlay
JavaScript
12
star
14

knockback-todos-app

The obligatory todo app for Knockback.js
JavaScript
12
star
15

knockback-inspector

Knockback-Inspector.js provides an inspector tree view library for Backbone.Models and Backbone.Collections using Knockback.js
JavaScript
12
star
16

knockback-reference-app

Knockback.js Reference Application provides a sample architecure for a Knockback.js application including page routing, separation of Models/ViewModels/Views, and memory management.
CoffeeScript
11
star
17

lifecycle

Lifecycle.js provides conventions and helpers to manage the life cycles of Javascript instances
JavaScript
7
star
18

nvs

Run commands on multiple versions of node. Useful for compatibility testing.
JavaScript
6
star
19

tinker

CoffeeScript
6
star
20

sequelize-parse-url

Parses a sequelize url into a configuration object
JavaScript
5
star
21

esm-import-directory

Import a directory of modules using @std/esm
JavaScript
4
star
22

QUnit.m

QUnit.m brings QUnit.js syntax to SenTestingKit for testing Objective-C projects.
Objective-C
4
star
23

esbuild-plugin-progress

A plugin to add a progress spinner to esbuild
JavaScript
3
star
24

fs-memory

An in-memory file system implementation
JavaScript
3
star
25

parser-multipart

Multipart form data parser for browser and node
TypeScript
3
star
26

couchpack-gem

This is a tool to help with packaging couchapps for mobile devices. See project: https://github.com/kmalakoff/phonegap-couchbase-xplatform
Ruby
3
star
27

gulp-webpack-config

Gulp plugin to run webpack on a stream of config file and wrap the results in a vinyl file
JavaScript
2
star
28

async-compat

Compatibility functions for writing libraries that support synchronous, callback and promise signatures
JavaScript
2
star
29

esbuild-plugin-realpath

A plugin to resolve the fs.realpath for modules in monorepos targeting the browser and node
JavaScript
2
star
30

gulp-wrap-define

Gulp plugin for wrapping files in a define statement
CoffeeScript
2
star
31

esm-require-directory

Require a directory of modules in a similar way to esm-import-directory
JavaScript
2
star
32

reduce-deep

Deep reduce an array
JavaScript
2
star
33

fetch-json-cache

Caches fetched json. Updates when etag changes and is uses cache regardless if endpoint unreachable. Uses write-file-atomic for safe updates
JavaScript
2
star
34

module-bundler

ModuleBundler combines javascript files and provides a minimal AMD-like loader to access them.
CoffeeScript
2
star
35

node-nuget

Nuget library wrapper for Node.js
JavaScript
2
star
36

walk-filtered

A simple, performant file system walker to provided fine-grained control over directories and files to walk.
JavaScript
2
star
37

node-resolve-versions

Convert a version expression to released Node.js versions (by full or partial semver, expression, or package.json engines.node)
JavaScript
1
star
38

readdirp-walk

An optimized readdirp-compliant directory walker that gives you control over concurrency and performance tradeoffs
JavaScript
1
star
39

fs-iterator

A file system iterator with filter and asyncIterator iterafaces. Supports Node 0.10 and above
JavaScript
1
star
40

ts-swc-loaders

Typescript loaders for swc
JavaScript
1
star
41

node-version-use

Cross-platform solution for running commands on a specific version of node
JavaScript
1
star
42

stack-base-iterator

Base iterator for values retrieved using a stack of async functions returning values
JavaScript
1
star
43

couchwatcher-gem

Watches for changes in a couchdb and allows the client to take actions on them.
Ruby
1
star
44

local-request

Generate superagent-compliant requests that can be used for mocking or wrapping APIs with in-process HTTP interfaces
JavaScript
1
star
45

ts-dev-stack

Development stack for TypeScript libraries
JavaScript
1
star
46

fs-generate

Utilities to set up file system structures (directories, files, and symlinks)
JavaScript
1
star
47

kmalakoff.github.com

HTML
1
star
48

examples-kmalakoff

Working code examples using repositories at https://github.com/kmalakoff
JavaScript
1
star
49

path-string-prepend

Prepends a path to a platform-specfic delimited path string and removes duplicate paths
JavaScript
1
star
50

benchmark-suite

A simple suite of benchmarking tests
JavaScript
1
star
51

isflattenable

Republish of lodash internal isflattenable method
JavaScript
1
star
52

maximize-iterator

Maximize the parallel calls of an iterator supporting asyncIterator interface
JavaScript
1
star
53

fast-extract

Extract contents from various archive types (tar, tar.bz2, tar.gz, tar.xz, tgz, zip)
JavaScript
1
star
54

each-package

Run commands in each package folder starting with cwd skipping node_modules folders
JavaScript
1
star