UNPKG

knockout-es5

Version:
46 lines (37 loc) 936 B
require('./src/knockout-es5'); var ko = require('knockout'); //todo: Проверить работу с browserify. Засунуть код из html сюда и запустить бандл. var ViewModel = function( first, last ) { this.firstName = first; this.lastName = last; this.nested = { one: 'one', two: 'two', three: { three_one: { three_one_one: 'asdfsadf', three_one_two: '3452345dfgdfgf' }, three_two: 'two' }, forth: [ 'a', 'b', 'c' ], five: [ {a: 'a', b: {a:'a'}} ] }; this.fullName = function() { return this.firstName + ' ' + this.lastName; }; //todo: add notation 'a b -c' - include a and b, exclude c ko.track(this, { //fields: [] //exclude: [] //filter: function( fieldName, fieldValue ){} deep: true }); }; var vm = new ViewModel('Planet', 'Earth'); window.vm = vm; ko.applyBindings( vm );