{"id":20023378,"url":"https://github.com/niku/petick","last_synced_at":"2025-05-05T02:30:36.949Z","repository":{"id":57531259,"uuid":"50581120","full_name":"niku/petick","owner":"niku","description":"Periodic timer built on a top of ErlangVM","archived":false,"fork":false,"pushed_at":"2018-07-10T21:11:44.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T15:06:14.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/petick","language":"Elixir","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/niku.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}},"created_at":"2016-01-28T12:23:28.000Z","updated_at":"2018-07-10T21:11:46.000Z","dependencies_parsed_at":"2022-09-26T18:22:05.927Z","dependency_job_id":null,"html_url":"https://github.com/niku/petick","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/niku%2Fpetick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fpetick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fpetick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niku%2Fpetick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niku","download_url":"https://codeload.github.com/niku/petick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252427614,"owners_count":21746245,"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-11-13T08:46:14.310Z","updated_at":"2025-05-05T02:30:36.679Z","avatar_url":"https://github.com/niku.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Petick\n\n[![Build Status](https://travis-ci.org/niku/petick.svg?branch=master)](https://travis-ci.org/niku/petick)\n\nPetick is an application for periodic timer which repeatedly calls a function with a fixed time delay between each call. It is built on a top of ErlangVM.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed as:\n\n  1. Add petick to your list of dependencies in `mix.exs`:\n\n        def deps do\n          [{:petick, \"~\u003e 0.0.1\"}]\n        end\n\n  2. Ensure petick is started before your application:\n\n        def application do\n          [applications: [:petick]]\n        end\n\n## Usage\n\n### Elixir\n\n```elixir\n# Starts timer : Petick.start/1\ncallback = fn pid -\u003e IO.puts \"called from #{inspect pid} #{inspect :calendar.now_to_datetime(:os.timestamp)}\" end\n{:ok, pid} = Petick.start(interval: 10000, callback: callback)\n# =\u003e {:ok, #PID\u003c0.153.0\u003e}\n\n# callback also can be defined tuple {Module, function}\ndefmodule Foo do\n  def bar(pid) do\n    IO.puts \"called from #{inspect pid} #{inspect :calendar.now_to_datetime(:os.timestamp)}\"\n  end\nend\n{:ok, pid2} = Petick.start(interval: 5000, callback: {Foo, :bar})\n# =\u003e {:ok, #PID\u003c0.164.0\u003e}\n\n# callback called at estimated time\n# =\u003e called from #PID\u003c0.153.0\u003e {{2016, 2, 7}, {14, 30, 8}}\n# =\u003e called from #PID\u003c0.164.0\u003e {{2016, 2, 7}, {14, 30, 12}}\n# =\u003e called from #PID\u003c0.164.0\u003e {{2016, 2, 7}, {14, 30, 17}}\n# =\u003e called from #PID\u003c0.153.0\u003e {{2016, 2, 7}, {14, 30, 18}}\n\n# Lists timers : Petick.list/0\nPetick.list\n# =\u003e [#PID\u003c0.164.0\u003e, #PID\u003c0.153.0\u003e]\n\n# Gets timer config : Petick.get/1\nPetick.get(pid2)\n# =\u003e {%Petick.Timer.Config{callback: {Foo, :bar}, interval: 5000}, 3074}\n\n# Terminates timer : Petick.terminate/1\nPetick.terminate(pid2)\n# =\u003e :ok\n\n# Changes interval of a timer : Petick.change_interval/2\nPetick.change_interval(pid, 1000)\n# =\u003e :ok\n# =\u003e called from #PID\u003c0.153.0\u003e {{2016, 2, 7}, {14, 30, 28}}\n# =\u003e called from #PID\u003c0.153.0\u003e {{2016, 2, 7}, {14, 30, 29}}\n# =\u003e called from #PID\u003c0.153.0\u003e {{2016, 2, 7}, {14, 30, 30}}\n\n# tear down\nPetick.terminate(pid)\n# =\u003e :ok\nPetick.list\n# =\u003e []\n```\n\n### Erlang\n\n(TBD)\n\n## LICENSE\n\nThis software is released under the MIT License, see LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniku%2Fpetick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniku%2Fpetick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniku%2Fpetick/lists"}