{"id":16153381,"url":"https://github.com/gigabyte5671/variablelistener","last_synced_at":"2025-09-13T16:32:48.750Z","repository":{"id":129315171,"uuid":"456038611","full_name":"Gigabyte5671/VariableListener","owner":"Gigabyte5671","description":"A library enabling JavaScript to execute arbitrary functions when the value of any global variable changes.","archived":false,"fork":false,"pushed_at":"2023-05-28T03:43:38.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T11:16:39.015Z","etag":null,"topics":["javascript","javascript-library","listener","variables"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/variable-listener","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gigabyte5671.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-06T02:36:49.000Z","updated_at":"2023-05-19T02:07:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"833ccd0e-5203-427b-beeb-137da7461cb6","html_url":"https://github.com/Gigabyte5671/VariableListener","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gigabyte5671%2FVariableListener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gigabyte5671%2FVariableListener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gigabyte5671%2FVariableListener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gigabyte5671%2FVariableListener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gigabyte5671","download_url":"https://codeload.github.com/Gigabyte5671/VariableListener/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569138,"owners_count":20959758,"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":["javascript","javascript-library","listener","variables"],"created_at":"2024-10-10T01:11:42.669Z","updated_at":"2025-04-06T23:38:38.798Z","avatar_url":"https://github.com/Gigabyte5671.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Variable Listener\n\nAllows JavaScript to execute arbitrary functions when the value of any global variable changes.\n\n![npm bundle size](https://img.shields.io/bundlephobia/min/variable-listener)\n\n\n## Installation\n\nTo add Variable Listener to your site or project:\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/variable-listener@latest/dist/variable-listener.min.js\"\u003e\u003c/script\u003e\n```\n\nor\n\n```bash\nnpm install variable-listener\n```\n\n```javascript\nimport 'variable-listener';\n```\n\n\n## Usage\n\nDeclare your global variable:\n```javascript\nvar count = 10;\n```\n\nAdd a new listener:\n``` javascript\nwindow.addVariableListener('count', function (newValue) {\n\n    console.log(newValue);\n\n});\n```\n\nThe callback will be triggered whenever your variable changes:\n```javascript\ncount++;\n\n// Callback logs: 11\n```\n\n\nIf you no longer want to listen to the variable, call:\n``` javascript\nwindow.removeVariableListener('count');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgigabyte5671%2Fvariablelistener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgigabyte5671%2Fvariablelistener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgigabyte5671%2Fvariablelistener/lists"}