Skip to content

Commit bc2d81a

Browse files
authored
return instance of the plugin itself
along with the dom elements, we return an instance of the plugin itself to have all of it's public methods available
1 parent 1a7aa36 commit bc2d81a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

jqClock.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ if (!String.prototype.padStart) {
141141
(function($, undefined) {
142142

143143
$.clock = {
144-
"version": "2.2.30",
144+
"version": "2.2.40",
145145
"options": [
146146
{
147147
"type": "string",
@@ -205,7 +205,11 @@ if (!String.prototype.padStart) {
205205
$.fn.clock = function(options) {
206206
var _this = this;
207207

208-
$.fn.clock.destroy = function(){
208+
this.initialize = function(){
209+
return this;
210+
}
211+
212+
this.destroy = function(){
209213
return _this.each(function(idx){
210214
var el_id = $(this).attr("id");
211215
if(_jqClock.hasOwnProperty(el_id)){
@@ -218,7 +222,7 @@ if (!String.prototype.padStart) {
218222
});
219223
}
220224

221-
$.fn.clock.stop = function(){
225+
this.stop = function(){
222226
return _this.each(function(idx){
223227
var el_id = $(this).attr("id");
224228
if(_jqClock.hasOwnProperty(el_id)){
@@ -228,7 +232,7 @@ if (!String.prototype.padStart) {
228232
});
229233
}
230234

231-
$.fn.clock.start = function(){
235+
this.start = function(){
232236
return _this.each(function(idx){
233237
var el_id = $(this).attr("id");
234238
var current_options = $(this).data("clockoptions");
@@ -477,7 +481,7 @@ if (!String.prototype.padStart) {
477481

478482
};
479483

480-
return this.each(function(idx){
484+
this.each(function(idx){
481485
if(typeof options === 'undefined' || typeof options === 'object'){
482486
//this is useful only for client timestamps...
483487
var sysDateObj = new Date();
@@ -595,6 +599,8 @@ if (!String.prototype.padStart) {
595599
}
596600
}
597601
});
602+
603+
return this.initialize();
598604
}
599605

600606
return this;

0 commit comments

Comments
 (0)