Skip to content

Commit

Permalink
knockout bindings no longer require a projection
Browse files Browse the repository at this point in the history
  • Loading branch information
bmavity committed May 3, 2013
1 parent bac8fa5 commit f742920
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
, "keywords": [
]
, "license": "Modified MIT"
, "license": "MIT +no-false-attribs, +no-advertising License"
, "main": "./wagner.js"
, "version": "0.4.0"
, "version": "0.5.0"
}
4 changes: 4 additions & 0 deletions wagner.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function Component(rootPath, options) {
if(root.nodeName.toLowerCase() === 'form') {
whenForm.forEach(addBehavior)
}

if(options.allowBinding) {
ko.call(component, options)
}
}
util.inherits(Component, events.EventEmitter2)

Expand Down
7 changes: 4 additions & 3 deletions wagner.ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ function transformToViewModel(schema) {
return vm
}

function knockoutDataBinder(schema) {
function knockoutDataBinder(options) {
var handlers = {}
, root = this._root
, isBound
, viewModel
, updater
options = options || {}

function ensureBound(schema) {
if(!isBound) {
Expand All @@ -66,8 +67,8 @@ function knockoutDataBinder(schema) {
updater.update(values)
}

if(schema) {
ensureBound(schema)
if(options.schema) {
ensureBound(options.schema)
}

this.update = update
Expand Down

0 comments on commit f742920

Please sign in to comment.