Thank you for looking after this plugin, Scott. Let me clear your
doubts:
a) You don't need coffeescript to use the plugin, just include the
knockout.model js file and you're ready to go! The thing is, the
plugin utilizes coffeescript object inheritance, which you can write
by yourself in javascript like this template:
(function() {
// object inheritante ugly stuff
var __hasProp = Object.prototype.hasOwnProperty, __extends =
function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key))
child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
// the model
this.Questionnaire = (function() {
__extends(Questionnaire, KnockoutModel);
// RESTful urls
Questionnaire.__urls = {
"index": "http://" + window.location.host + "/aplic/
editor_questionarios/get/busca_questionarios.php",
};
// Parameters we don't want to send to the server
Questionnaire.__transientParameters = ["someTempValue"];
// attributes declaration
function Questionnaire() {
this.id = ko.observable("");
this.title = ko.observable("");
this.someTempValue = ko.observable("foo");
Questionnaire.__super__.constructor.call(this);
}
return Questionnaire;
})();
}).call(this);
b) I don't use the mapping plugin so I never thought about some kind
of bridge, but you can always set the model instance values with a
valid js object:
questionnaire.set({id: 2, title: "test"});
c) model.get() is mostly used internally, since you can have
observable and non-observable attributes, but I think model.set() is
really useful, instead of passing a chain setting observable(or non-
observable) values you can just pass an object to feed the model.