'Durandal framework basics
I am going through few slides in developing a SPA using Durandal and other JavaScript library.
I have a few questions:
define('projects', [],
function() {
var Projects = function () {
this.myDataLocal = ko.observable();
this.myDataFromServices = null;
};
Projects.prototype.activate = function (activationData) {
this.myDataFromServices = activationData
this.myDataLocal(activationData());
};
Projects.prototype.detached = function () {
this.myDataFromServices(this.myDataLocal());
};
return Projects;
}
);
a. In the above code is
var Projects = function () {
};
a constructor?
b. When we are adding a function to prototype ,
Projects.prototype.activate = function (activationData) {
}
will this also be considered as a constructor and executed automatically on the function load?
c. To qualify a function for a constructor is it enough if we are defining the name of the just like this?
var ProjectsSample100 = function () {
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|