2015-02-18 11:31:00 +00:00
|
|
|
define([
|
2015-03-17 09:41:04 +00:00
|
|
|
'jquery', 'knockout', 'text!./Stopwatch.html', 'jquery-ui/dialog', 'kojqui/button'
|
2015-02-18 11:31:00 +00:00
|
|
|
], function(jquery, ko, htmlString) {
|
|
|
|
|
|
|
|
function ViewModel(params) {
|
|
|
|
var self = this;
|
|
|
|
|
2015-02-22 20:18:23 +00:00
|
|
|
self.watches = ko.observableArray([]);
|
2015-02-18 11:31:00 +00:00
|
|
|
|
|
|
|
self.addWatch = function() {
|
|
|
|
self.watches.push(self.watches().length);
|
|
|
|
}
|
2015-03-17 09:41:04 +00:00
|
|
|
|
|
|
|
self.toDialog = function(a,evt) {
|
|
|
|
var p = jquery(evt.target).parent();
|
|
|
|
p.next().dialog({
|
|
|
|
title: p.text(),
|
|
|
|
closeOnEscape: false,
|
|
|
|
});
|
|
|
|
p.remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
self.addWatch();
|
2015-02-18 11:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ViewModel.prototype.dispose = function() {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return component definition
|
|
|
|
return {
|
|
|
|
viewModel : ViewModel,
|
|
|
|
template : htmlString
|
|
|
|
};
|
|
|
|
});
|