Build 0.4.6.
Showing
5 changed files
with
23 additions
and
19 deletions
... | @@ -2,8 +2,8 @@ | ... | @@ -2,8 +2,8 @@ |
2 | "name": "rivets", | 2 | "name": "rivets", |
3 | "repo": "mikeric/rivets", | 3 | "repo": "mikeric/rivets", |
4 | "description": "Declarative data binding facility.", | 4 | "description": "Declarative data binding facility.", |
5 | "version": "0.4.5", | 5 | "version": "0.4.6", |
6 | "keywords": ["data binding", "template"], | 6 | "keywords": ["data binding", "templating"], |
7 | "scripts": ["lib/rivets.js"], | 7 | "scripts": ["lib/rivets.js"], |
8 | "main": "lib/rivets.js", | 8 | "main": "lib/rivets.js", |
9 | "license": "MIT" | 9 | "license": "MIT" | ... | ... |
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.4.5 | 2 | // version: 0.4.6 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
6 | var Rivets, bindEvent, getInputValue, rivets, unbindEvent, | 6 | var Rivets, bindEvent, factory, getInputValue, unbindEvent, |
7 | __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | 7 | __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, |
8 | __slice = [].slice, | 8 | __slice = [].slice, |
9 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | 9 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; |
... | @@ -480,7 +480,7 @@ | ... | @@ -480,7 +480,7 @@ |
480 | return unbindEvent(el, 'change', this.currentListener); | 480 | return unbindEvent(el, 'change', this.currentListener); |
481 | }, | 481 | }, |
482 | routine: function(el, value) { | 482 | routine: function(el, value) { |
483 | var o, _i, _len, _ref, _results; | 483 | var o, _i, _len, _ref, _ref1, _results; |
484 | if (el.type === 'select-multiple') { | 484 | if (el.type === 'select-multiple') { |
485 | if (value != null) { | 485 | if (value != null) { |
486 | _results = []; | 486 | _results = []; |
... | @@ -490,7 +490,7 @@ | ... | @@ -490,7 +490,7 @@ |
490 | } | 490 | } |
491 | return _results; | 491 | return _results; |
492 | } | 492 | } |
493 | } else { | 493 | } else if ((value != null ? value.toString() : void 0) !== ((_ref1 = el.value) != null ? _ref1.toString() : void 0)) { |
494 | return el.value = value != null ? value : ''; | 494 | return el.value = value != null ? value : ''; |
495 | } | 495 | } |
496 | } | 496 | } |
... | @@ -581,11 +581,11 @@ | ... | @@ -581,11 +581,11 @@ |
581 | 581 | ||
582 | Rivets.formatters = {}; | 582 | Rivets.formatters = {}; |
583 | 583 | ||
584 | rivets = { | 584 | factory = function(exports) { |
585 | binders: Rivets.binders, | 585 | exports.binders = Rivets.binders; |
586 | formatters: Rivets.formatters, | 586 | exports.formatters = Rivets.formatters; |
587 | config: Rivets.config, | 587 | exports.config = Rivets.config; |
588 | configure: function(options) { | 588 | exports.configure = function(options) { |
589 | var property, value; | 589 | var property, value; |
590 | if (options == null) { | 590 | if (options == null) { |
591 | options = {}; | 591 | options = {}; |
... | @@ -594,8 +594,8 @@ | ... | @@ -594,8 +594,8 @@ |
594 | value = options[property]; | 594 | value = options[property]; |
595 | Rivets.config[property] = value; | 595 | Rivets.config[property] = value; |
596 | } | 596 | } |
597 | }, | 597 | }; |
598 | bind: function(el, models) { | 598 | return exports.bind = function(el, models) { |
599 | var view; | 599 | var view; |
600 | if (models == null) { | 600 | if (models == null) { |
601 | models = {}; | 601 | models = {}; |
... | @@ -603,13 +603,17 @@ | ... | @@ -603,13 +603,17 @@ |
603 | view = new Rivets.View(el, models); | 603 | view = new Rivets.View(el, models); |
604 | view.bind(); | 604 | view.bind(); |
605 | return view; | 605 | return view; |
606 | } | 606 | }; |
607 | }; | 607 | }; |
608 | 608 | ||
609 | if (typeof module !== "undefined" && module !== null) { | 609 | if (typeof exports === 'object') { |
610 | module.exports = rivets; | 610 | factory(exports); |
611 | } else if (typeof define === 'function' && define.amd) { | ||
612 | define(['exports'], function(exports) { | ||
613 | return this.rivets = factory(exports); | ||
614 | }); | ||
611 | } else { | 615 | } else { |
612 | this.rivets = rivets; | 616 | factory(this.rivets = {}); |
613 | } | 617 | } |
614 | 618 | ||
615 | }).call(this); | 619 | }).call(this); | ... | ... |
This diff is collapsed.
Click to expand it.
1 | { | 1 | { |
2 | "name" : "rivets", | 2 | "name" : "rivets", |
3 | "description" : "Declarative data binding facility.", | 3 | "description" : "Declarative data binding facility.", |
4 | "version" : "0.4.5", | 4 | "version" : "0.4.6", |
5 | "author" : "Michael Richards", | 5 | "author" : "Michael Richards", |
6 | "url" : "http://rivetsjs.com", | 6 | "url" : "http://rivetsjs.com", |
7 | "main" : "./lib/rivets.js", | 7 | "main" : "./lib/rivets.js", | ... | ... |
-
Please register or sign in to post a comment