{"id":16441205,"url":"https://github.com/reinerba/vue-interval","last_synced_at":"2025-03-23T08:31:57.945Z","repository":{"id":14528078,"uuid":"76685611","full_name":"reinerBa/Vue-Interval","owner":"reinerBa","description":"A vuejs mixin to call methods and update variables in intervals","archived":false,"fork":false,"pushed_at":"2024-01-17T22:00:21.000Z","size":1202,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-16T11:32:51.152Z","etag":null,"topics":["interval","time-interval","vue-interval","vue-mixin","vuejs","vuejs2"],"latest_commit_sha":null,"homepage":"https://reinerba.github.io/Vue-Interval/","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/reinerBa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-16T21:05:36.000Z","updated_at":"2022-02-13T11:03:43.000Z","dependencies_parsed_at":"2024-01-14T06:04:27.275Z","dependency_job_id":"749824be-b4c8-4750-be9b-98a1b0e9be0a","html_url":"https://github.com/reinerBa/Vue-Interval","commit_stats":{"total_commits":50,"total_committers":7,"mean_commits":7.142857142857143,"dds":0.74,"last_synced_commit":"519302f09f00c6fa87758c6b0ceae7999f8e1e63"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinerBa%2FVue-Interval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinerBa%2FVue-Interval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinerBa%2FVue-Interval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinerBa%2FVue-Interval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reinerBa","download_url":"https://codeload.github.com/reinerBa/Vue-Interval/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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":["interval","time-interval","vue-interval","vue-mixin","vuejs","vuejs2"],"created_at":"2024-10-11T09:14:03.379Z","updated_at":"2025-03-23T08:31:57.622Z","avatar_url":"https://github.com/reinerBa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue-Interval\n[![NPM](https://nodei.co/npm/vue-interval.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/vue-interval/)\n\nAn interval mixin to call static vue-functions in an interval, update values, get current time and dynamic interval management\n\n- **Dependencies:** Only Vue.js 2.0\n- **Browsers tested:** Chrome, Firefox and IE10+\n- **Demo:** [link](https://reinerba.github.io/Vue-Interval/Demo.html \"Demo\")\n\n# Features\n\nThis mixin adds reactive data and method to your components:\n\n## Functions\n* Automatically recognize Vue-Element methods that starts with Interval__[Timeinterval]$ as interval methods and execute/stop them on dismount\n* Add new intervals with setVueInterval\n* Add new intervals with callback function after exceeding interval limit\n* Remove manually setted intervals with removeVueInterval\n* Suspend manually setted intervals with suspendVueInterval\n* Remove manually setted intervals with suspendVueInterval\n\n## Properties\n* Use `ticker` as a simple secound counter since creation (the interval can be adjusted)\n* or to update the value non-reactive variables in computed properties every secound\n* use `dateNow` as Date.now() persistence that gets updated every secound\n* update intervals adjustable\n\n# Usage\nIt's available as npm package now and has a module defintion file for webpack\n\n    npm install vue-interval -s\n    import vueinterval from 'vue-interval/dist/VueInterval.common'\n\n\nTo make the mixin globally available for every instance or component just add the script in the head tag (or somewhere in the body)\n\n    \u003cscript src=\"VueInterval.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n\nAnd add it to the desired components\n\n    new Vue({\n        el: \"#app\",\n        mixins:[vueinterval],\n        data: {...},\n        methods: {\n          INTERVAL__1e3$ping: function () {\n            console.log('Another secound has passed')\n          }\n        },\n\nAfter this you can use the interval variables `ticker` and `dateNow`. The first variable just counts up from zero every secound, where 0 is the moment when the component was created. The secound variable is the current Date.now() which is also updated every secound. \n\nTo write a method in your component which is triggered in interval just use the prefix `INTERVAL__[timeperiod]$` with timeperiod as number like:\n\n    INTERVAL__1e4$myUpdateMethod: function (a) {\n            Ajax.get('/update/opentasks');\n        }\n\nThis method for instance will make an ajax call every 10 secounds `(1e4 =\u003e 10.000ms)`.\n\n# License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinerba%2Fvue-interval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freinerba%2Fvue-interval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinerba%2Fvue-interval/lists"}