Toolkit
I’m trying to document my classes but i’m using a “self” var to expose only the public methods.
jsDoc can find the class name, but can’t find the methods, fields, properties, etc…
this is 1 of my classes:
Anny suggestion how I should approach this?
(function(App){
/** @class The ViewModel for the EventView */
App.ViewModels.EventsViewModel = function(service) {
var self = {};
/** Observable array containing events */
self.events = new ko.observableArray();
/** Call the fetchEvents method on the service */
self.refreshEvents = function(e){
$('.refreshBtn').changeIcon('refreshing');
service.fetchEvents();
}
/** subscribe on the service->currentEvents var
* on change update the events in this viewmodel
* set the refesh butting is set to refresh (instead of refreashing) */
service.currentEvents.subscribe(
function(newValue){
self.events(newValue);
$('.refreshBtn').changeIcon('refresh');
}
);
/** function for a timespan string ex: "10:00 - 14:00"
* Date inputs should be of ISO-8601 Date format */
self.toTimeString= function(/* String */ start,/* String */ end)/* String */
{
var out = "";
try
{
out =(start!=null && end!=null)? Util.IsoDateParse(start).format("HH:MM") + " - " + Util.IsoDateParse(end).format("HH:MM") : ""
}
catch(err)
{
out ="Error during toTimeString.\n\n";
out+="Error description: " + err + "\n\n";
}
return out;
}
/** Call the fetchEvents method on the service */
self.refreshEvents();
return self;
};
})(App)
ps: I’m using Knockoutjs & jQueryMobile
EDIT:
Thanks! Almost there… I tried to do something like this:
/** @memberOf App.ViewModels.EventsViewModel#
* @field * @description Observable array containing events */
self.events = new ko.observableArray();
jsDoc shows it like “self.events” instead of “events”
Use the
memberOftag(TagMemberOf). And sinceApp.ViewModels.EventsViewModelis declared in an anonymous function you may need to use thenametag(TagName) to scope it as global.Edit:
Try: