{"id":23035810,"url":"https://github.com/blackchef/leave-a-message","last_synced_at":"2025-04-02T22:41:34.827Z","repository":{"id":51837378,"uuid":"126444522","full_name":"blackChef/leave-a-message","owner":"blackChef","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-17T05:34:46.000Z","size":34,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T20:04:08.238Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/blackChef.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":"2018-03-23T06:48:00.000Z","updated_at":"2020-07-19T00:39:56.000Z","dependencies_parsed_at":"2023-01-22T04:16:21.939Z","dependency_job_id":null,"html_url":"https://github.com/blackChef/leave-a-message","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackChef%2Fleave-a-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackChef%2Fleave-a-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackChef%2Fleave-a-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackChef%2Fleave-a-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackChef","download_url":"https://codeload.github.com/blackChef/leave-a-message/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905830,"owners_count":20852818,"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-12-15T16:47:05.742Z","updated_at":"2025-04-02T22:41:34.807Z","avatar_url":"https://github.com/blackChef.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leave-a-message\nA pub-sub pattern like event system. But instead of push message to subscribers, subscribers must manually pull message from pub-sub center.\n\n# Usage\n    import { publish, subscribe } from 'leave-a-message';\n\n    let options = {\n      // If `saveHistory === false`, only the latest message would be kept,\n      // otherwise, user can read an array of new messages. Default is false.\n      saveHistory: true \n    };\n\n    let channelName = 'channel_foo';\n\n    let { readMsg, unsubscribe } = subscribe(channelName, options);\n\n    publish(channelName, 'abc');\n    publish(channelName, 'def');\n\n    // Get ['def', 'abc'] or 'def' if `saveHistory === false`\n    console.log( readMsg() ); \n\n    // No new messages. Get [] or undefined if `saveHistory === false`.\n    console.log( readMsg() ); \n\n\n    unsubscribe();\n\n    // Throw error if user already unsubscribed the channel.\n    readMsg();\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackchef%2Fleave-a-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackchef%2Fleave-a-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackchef%2Fleave-a-message/lists"}