{"id":25510155,"url":"https://github.com/huotchu/watch","last_synced_at":"2025-07-24T05:35:27.315Z","repository":{"id":93803589,"uuid":"100996651","full_name":"HuotChu/Watch","owner":"HuotChu","description":"Watch provides a clean, obvious syntax for managing events within Roblox Lua code.","archived":false,"fork":false,"pushed_at":"2017-08-28T03:39:48.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T14:45:58.881Z","etag":null,"topics":["roblox","roblox-lua","roblox-studio","robloxdev"],"latest_commit_sha":null,"homepage":"https://www.roblox.com/games/994624803/Watch-Module-for-Roblox-Development","language":"Lua","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/HuotChu.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":"2017-08-21T22:10:57.000Z","updated_at":"2022-07-17T14:16:49.000Z","dependencies_parsed_at":"2023-03-11T22:45:19.673Z","dependency_job_id":null,"html_url":"https://github.com/HuotChu/Watch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HuotChu/Watch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuotChu%2FWatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuotChu%2FWatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuotChu%2FWatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuotChu%2FWatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HuotChu","download_url":"https://codeload.github.com/HuotChu/Watch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuotChu%2FWatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266796852,"owners_count":23985486,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["roblox","roblox-lua","roblox-studio","robloxdev"],"created_at":"2025-02-19T09:14:42.618Z","updated_at":"2025-07-24T05:35:27.295Z","avatar_url":"https://github.com/HuotChu.png","language":"Lua","readme":"# Watch\n\n\u003e Work In Progress: Version 0.2.0 (Beta)\n\n### Watch provides a clean, obvious syntax for managing events within Roblox Lua code.\n\n  - Eventing-made-easy with 4 way event communication.\n      - Server \u003e Server\n      - Server \u003e Client\n      - Client \u003e Server\n      - Client \u003e Client\n  - Supports FilteringEnabled, Experimental, and Studio Solo Play\n  - Watch the properties of any Table for changes!\n  - Watch your own synthetic objects fire synthetic events!\n  - No need to create RemoteEvents!!!\n\n## Installation:\n  1. Create a new ModuleScript in ServerScriptService\n  2. Rename the ModuleScript to **Watch**\n  3. Copy the contents of Watch.lua into your ModuleScript and Save.\n  \n To use **Watch** in your Scripts/LocalScripts:\n \n ```lua\n     local ServerScriptService = game:GetService('ServerScriptService')\n     local Watch = require(ServerScriptService:WaitForChild('Watch'))\n ```\n \n \u003e Sample Game with Examples (no copylock) [https://www.roblox.com/games/994624803/Watch-Module-for-Roblox-Development]\n\n## Jasmine-inspired syntax\n\n  - Type it like you say it\n  - Easy to remember, fast to type\n\n```lua\n  ----[ Synthetic Event Example ]----\n  \n  -- Make up a name for the thing to watch\n  local state = Watch('State')\n  \n  -- Name the event to listen to\n  local stateChange = state:On('Change')\n  \n  -- attach event handler\n  stateChange:Do(function (state) print(state) end)\n  \n  -- Easy way to write the same thing in one line...\n  Watch('State'):On('Change'):Do(function (state) print(state) end)\n  \n  -- Pro-Tip #1: Method names *On* and *Do* are **optional**\n  -- Pro-Tip #2: This form is not recommended, unless you understand why it works\n  Watch('State')('Change')(function (state) print(state) end)\n  \n  -- Fire the event\n  Watch('State'):Fire('change', 'someValue')\n  \n  -- Prints 'someValue'\n```\n\n**Watch** is designed to combine coding efficiency with common grammatical constructs.\n\n  - Always *Watch* a **Noun** (*optionally pass a Table to Watch after the Name)\n      + local player = Watch(**'Player'**)\n      + local data = Watch(**'DataStore'**)\n      + local ray = Watch(**'FreezeRay'**)\n      + ----------------------TABLE EXAMPLE----------------------\n      + local p1 = Watch(**'Player1'**, {name='Player1', health=100})\n      \n  - Always *On* a **Verb** [Note: On is short for Upon]\n      + local onRun = player:On(**'Run'**)\n      + local onData = data:On(**'Update'**)\n      + local onHit = ray:On(**'Hit'**)\n      + -----------TABLES TEND TO BREAK THE VERB RULE-----------\n      + local onHealthChange = p1:On(**'health'**)\n      \n  - Always *Do* a **Function**\n      + local playSoundId = onRun:Do(**function() runSound.Play() end**)\n      + local updateTxtId = onData:Do(**function(txt) script.Parent.Text=txt end**)\n      + local hitHandlerId = onHit:Do(**function(effect) session.status=effect end**)\n      + ----------------------TABLE EXAMPLE----------------------\n      + local p1HealthId = onHealthChange:Do(function (v, k) print(k..' is '..v) end)\n      \n  - Always *Fire*, *FireOnce*, or *FireAcross* a **Verb**\n      + player:Fire(**'Run'**)\n      + data:FireAcross(**'Update'**, 'Data!')\n      + ray:FireOnce(**'Hit'**, 'frozen')\n      + ------TABLE EVENTS FIRE WHEN PROPERTY VALUES CHANGE------\n      + p1.health = '90'\n      \n## Four Ways to Fire Events\n\n1. Watch(Noun):Fire(Verb, Args)\n    * Fire - fires the event on both Client \u0026 Server\n2. Watch(Noun):FireAcross(Verb, Args)\n    * FireAcross - fires the event to the other side only\n    * Client fires across to Server OR Server fires across to Client\n3. Watch(Noun):FireOnce(Verb, Args)\n    * FireOnce - fires the event to the same side only\n    * Client fires to Client OR Server fires to Server\n4. Watch(Noun, Table)\n    * Returns a proxy table.\n    * Changing the proxy updates the original table.\n    * 'Get' and 'Set' fire events for watched properties only.\n    * local foo = table.prop fires a 'Get' event\n    * table.prop = 'foo' fires a 'Set' event\n    * Event handlers receive 3 arguments on 'Get', 4 on 'Set'\n    * Arguments, in order, are **value**, **key**, **accessType**, **oldValue**\n        + value = the current value in the table\n        + key = the property name of the table\n        + accessType = the string 'Get' or 'Set'\n        + oldValue = passed on 'Set', the value before it was changed\n\n\u0026nbsp;\n\n...more to come!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuotchu%2Fwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuotchu%2Fwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuotchu%2Fwatch/lists"}