{"id":18074177,"url":"https://github.com/bytespider/downtime","last_synced_at":"2025-04-12T05:52:26.172Z","repository":{"id":5590230,"uuid":"6796641","full_name":"bytespider/downtime","owner":"bytespider","description":"jQuery plugin for customisable timers and timed events","archived":false,"fork":false,"pushed_at":"2013-02-14T10:44:07.000Z","size":168,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T05:52:10.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bytespider.github.com/downtime/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytespider.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-21T14:07:41.000Z","updated_at":"2016-02-24T08:26:47.000Z","dependencies_parsed_at":"2022-07-07T05:33:59.210Z","dependency_job_id":null,"html_url":"https://github.com/bytespider/downtime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytespider%2Fdowntime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytespider%2Fdowntime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytespider%2Fdowntime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytespider%2Fdowntime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytespider","download_url":"https://codeload.github.com/bytespider/downtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525156,"owners_count":21118616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T10:11:31.939Z","updated_at":"2025-04-12T05:52:26.135Z","avatar_url":"https://github.com/bytespider.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Downtime\n[![endorse](http://api.coderwall.com/bytespider/endorsecount.png)](http://coderwall.com/bytespider)  \n\njQuery plugin for customisable timers and timed events.\n\n## Usage\n\n```javascript\n$('#my-countdown-timer').downtime({\n    time: 60,\n    intervalFrequency: 1000,             /* how often the timer ticks, in milliseconds. Default: 1000 */\n    type: 'countdown',                  /* or countup. Default: countdown */\n    autostart: false,                   /* true to start the timer right away. Default: true */\n    complete: function () {             /* Optional function to call when timer completes. */\n        alert('YAY! All done.');\n    },\n    hoursFormat: function (time) {      /* Optional function to format the hours component */\n        return time + 'hours';          /* Default: Returns component padded 2 digits */\n    },\n    minutesFormat: function (time) {    /* Optional function to format the minutes component */\n        return time + 'minutes';        /* Default: Returns component padded 2 digits */\n    },\n    secondsFormat: function (time) {    /* Optional function to format the seconds component */\n        return time + 's';              /* Default: Returns component padded 2 digits */\n    }\n});\n```\n\n### Simplest usage\n\n    \u003cdiv id=\"my-countdown-timer\"\u003e\n        \u003cspan data-bind=\"hours\"\u003e\u003c/span\u003e hours\n        \u003cspan data-bind=\"minutes\"\u003e\u003c/span\u003e minutes\n        \u003cspan data-bind=\"hours\"\u003e\u003c/span\u003e seconds\n    \u003c/div\u003e\n    \u003cscript\u003e\n        $('#my-countdown-timer').downtime({time: 2700});\n    \u003c/script\u003e\n\n## API Documentation\n\n### Options\n\n#### time\n\nThe length of time the timer will run form. This number depends on `intervalFrequency`, such that the resolution is increased or decreased.\n\n##### Code examples:\n\nInitialise the timer with the time option specified:\n\n    $('.selector').downtime({time: 60});\n\nGet or set the time option after initialisation:\n\n    // getter\n    var current_time = $('.selector').downtime('option', 'time');\n\n    // setter\n    $('.selector').downtime('option', 'time', 100);\n\n#### intervalFrequency\n\nHow often in milliseconds the timer will update. Each tick will increment or decrement the time by 1.\nThe resolution of the timer can be incresed by setting an `intervalFrequency` higher than 1000, for instance an `intervalFrequency` of 1 means that `time` has a resolution of n*milliseconds whereas an `intervalFrequency` of 60000 means that `time` has a resolution of hours.\n\nDefault: 1000\n\n##### Code examples:\n\nInitialise the timer with the time option specified:\n\n    $('.selector').downtime({intervalFrequency: 1000});\n\nGet or set the intervalFrequency option after initialisation:\n\n    // getter\n    var interval_ms = $('.selector').downtime('option', 'intervalFrequency');\n\n    // setter\n    $('.selector').downtime('option', 'intervalFrequency', 1000);\n\n#### type\n\nIf the timer is a countdown timer or a count up timer.\n\nDefault: 'countdown'\n\n##### Code examples:\n\nInitialise the timer with the type option specified:\n\n    $('.selector').downtime({type: 'countup'});\n\n#### autostart\n\nIf the timer is a countdown timer or a count up timer.\n\nDefault: true\n\n##### Code examples:\n\nInitialise the timer with the autostart option specified:\n\n    $('.selector').downtime({autostart: false});\n\n#### autostart\n\nIf the timer is a countdown timer or a count up timer.\n\nDefault: true\n\n##### Code examples:\n\nInitialise the timer with the autostart option specified:\n\n    $('.selector').downtime({autostart: false});\n\n#### hoursFormat\n\nA function to format the hours component.\n\nDefault: `function (time) { return (time + '').replace(/^($\\d)$/, '0$1'); }`\n\n##### Code examples:\n\nInitialise the timer with the hoursFormat option specified:\n\n    $('.selector').downtime({hoursFormat: function (time) {\n        return time + 'hours'\n    }});\n\nGet or set the hoursFormat option after initialisation:\n\n    // getter\n    var hours_formater = $('.selector').downtime('option', 'hoursFormat');\n\n    // setter\n    $('.selector').downtime('option', 'hoursFormat', function (time) {\n        return time + 'hours'\n    });\n\n#### minutesFormat\n\nA function to format the minutes component.\n\nDefault: `function (time) { return (time + '').replace(/^($\\d)$/, '0$1'); }`\n\n##### Code examples:\n\nInitialise the timer with the minutesFormat option specified:\n\n    $('.selector').downtime({minutesFormat: function (time) {\n        return time + 'minutes'\n    }});\n\nGet or set the minutesFormat option after initialisation:\n\n    // getter\n    var minutes_formater = $('.selector').downtime('option', 'minutesFormat');\n\n    // setter\n    $('.selector').downtime('option', 'minutesFormat', function (time) {\n        return time + 'minutes'\n    });\n\n#### secondsFormat\n\nA function to format the seconds component.\n\nDefault: `function (time) { return (time + '').replace(/^($\\d)$/, '0$1'); }`\n\n##### Code examples:\n\nInitialise the timer with the secondsFormat option specified:\n\n    $('.selector').downtime({secondsFormat: function (time) {\n        return time + 'seconds'\n    }});\n\nGet or set the secondsFormat option after initialisation:\n\n    // getter\n    var seconds_formater = $('.selector').downtime('option', 'secondsFormat');\n\n    // setter\n    $('.selector').downtime('option', 'secondsFormat', function (time) {\n        return time + 'seconds'\n    });\n\n\n### Methods\n\n#### start\n\nStarts the timer if it isn’t already running.\n\n##### Code examples:\n\nInvoke the start method:\n\n    $('.selector').downtime('start');\n\n#### pause\n\nPauses a running timer.\n\n##### Code examples:\n\nInvoke the pause method:\n\n    $('.selector').downtime('pause');\n\n#### stop\n\nStops a running timer and resets the time.\n\n##### Code examples:\n\nInvoke the stop method:\n\n    $('.selector').downtime('stop');\n\n#### show\n\nShow the DOM element containing the timer. Passing standard `.show()` arguments.\n\n##### Code examples:\n\nInvoke the show method:\n\n    $('.selector').downtime('show', 'fast');\n\n#### hide\n\nHide the DOM element containing the timer. Passing standard `.hide()` arguments.\n\n##### Code examples:\n\nInvoke the hide method:\n\n    $('.selector').downtime('hide', 'fast', function () {\n        alert('animation complete');\n    });\n\n\n### Events\n\n##### complete(data)\n\nTriggered when the timer reaches it’s goal.\n\n##### Code examples:\n\nInitialise the timer with the complete option specified:\n\n    $('.selector').downtime({complete: function () {\n        alert('All done!');\n    }});\n\nGet or set the complete option after initialisation:\n\n    // getter\n    var complete_callback = $('.selector').downtime('option', 'complete');\n\n    // setter\n    $('.selector').downtime('option', 'complete', function () {\n        alert('All done!');\n    });\n\n#### downtime.update(event, data)\nThis event is triggered when any timer ticks.\n\n- event: Event\n- data:\n    - item: Object\n    - hours: Integer\n    - minutes: Integer\n    - seconds: Integer\n    - time: Integer\n\n##### Code examples:\n\n    $(window).bind('downtime.update', function (event, data) {\n        console.log('You have: ' + data.hours + ' hours ' + data.minutes + ' minutes ' + data.seconds ' seconds left to live');\n    });\n\n#### downtime.complete(event, data)\nThis event is triggered when any timer completes.\n\n- event: Event\n- data:\n    - item: Object\n\n##### Code examples:\n\n    $(window).bind('downtime.complete', function (event, data) {\n        console.log(data.item, 'completed timer');\n    });\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytespider%2Fdowntime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytespider%2Fdowntime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytespider%2Fdowntime/lists"}