{"id":13736520,"url":"https://github.com/Pandawan/deno_notify","last_synced_at":"2025-05-08T12:33:00.030Z","repository":{"id":62421406,"uuid":"266703602","full_name":"Pandawan/deno_notify","owner":"Pandawan","description":"✉️ Send desktop notifications on all platforms in Deno","archived":false,"fork":false,"pushed_at":"2023-03-07T09:07:10.000Z","size":282,"stargazers_count":46,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-04T00:06:11.067Z","etag":null,"topics":["cross-platform","deno","notification","rust","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Pandawan.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}},"created_at":"2020-05-25T06:41:10.000Z","updated_at":"2024-06-02T13:10:19.000Z","dependencies_parsed_at":"2024-04-26T05:37:41.821Z","dependency_job_id":"154a074d-2dd6-46ad-a8c8-c37ccff005d7","html_url":"https://github.com/Pandawan/deno_notify","commit_stats":{"total_commits":55,"total_committers":1,"mean_commits":55.0,"dds":0.0,"last_synced_commit":"0d3dc105e5bca5729680d32f229b9793ecf60515"},"previous_names":["pandawanfr/deno_notify"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pandawan%2Fdeno_notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pandawan%2Fdeno_notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pandawan%2Fdeno_notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pandawan%2Fdeno_notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pandawan","download_url":"https://codeload.github.com/Pandawan/deno_notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224732129,"owners_count":17360416,"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":["cross-platform","deno","notification","rust","typescript"],"created_at":"2024-08-03T03:01:23.372Z","updated_at":"2024-11-15T04:31:58.770Z","avatar_url":"https://github.com/Pandawan.png","language":"TypeScript","readme":"# deno_notify\n\n[![license](https://img.shields.io/github/license/Pandawan/deno_notify)](https://github.com/Pandawan/deno_notify/blob/master/LICENSE)\n[![build](https://img.shields.io/github/actions/workflow/status/Pandawan/deno_notify/.github/workflows/build.yml?branch=master)](https://github.com/Pandawan/deno_notify/actions/workflows/build.yml)\n[![deno version](https://img.shields.io/badge/deno-1.31.1-success)](https://github.com/denoland/deno)\n[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/deno_notify/ts/mod.ts)\n\nSend desktop notifications on all platforms in Deno.\\\nSupports Windows, macOS, and linux using\n[notify-rust](https://github.com/hoodie/notify-rust) though some features are\nplatform-specific.\n\nNote: More features are in the works and the API may change as a result.\n\n## Usage\n\nThe `mod.ts` entrypoint uses [Plug](https://github.com/denosaurs/plug)\ninternally so you don't have to download or open the plugin manually.\n\n_You will need to run using the `--unstable` and `--allow-all` permissions to\nallow for automatic plugin loading and caching._\n\n```ts\nimport { Notification } from \"https://deno.land/x/deno_notify@1.4.3/ts/mod.ts\";\n\n// Create a new notification\nconst notif = new Notification();\n\n// Add a simple message\nnotif.title(\"My message\");\n\n// Display it\nnotif.show();\n```\n\nOr stack together your desired options:\n\n```ts\nnew Notification({ macos: true })\n  .title(\"My message\")\n  .subtitle(\"It's very important...\")\n  .body(\"Hello, World!\")\n  .soundName(\"Basso\")\n  .show();\n```\n\n## Documentation\n\nCheck out the\n[Documentation](https://doc.deno.land/https/deno.land/x/deno_notify/ts/mod.ts)\nfor a list of available features.\n\n### Platform-Specific Features\n\nBy default, only cross-platform features are available. In order to enable\nplatform-specific features (e.g. icons), you can pass in booleans flags to\nspecify the supported platforms in the `Notification`'s constructor.\n\n```ts\n// Enable linux-specific-features\nconst notif = new Notification({ linux: true });\n\n// Notification.icon() is now available\nnotif.icon(\"/path/to/icon\");\n```\n\nSpecifying platforms may also provide different documentation and typings for\nthe `Notification` API.\n\nFor example, macOS has specific sound names that are available for\nNotifications; these are reflected in the macOS-specific Notification API.\n\n![IntelliSense Suggesting MacOS Sound Names When Calling Notification.soundName()](./images/macos_soundName_typings.png)\n\n#### Strict Platform Checking\n\nThe second parameter of the `Notification`'s constructor can be used to\ndetermine whether the platform-features should be checked at runtime. When\n`true` (default), any platform-specific feature will error if used on a platform\nthat does not support it. When `false`, the error will be silently ignored.\n\nNote: Platform checking is performed both at compile time (TypeScript) and at\nruntime.\n\n```ts\n// Icons are not supported on macOS\n// If notif.icon() is called on a macOS computer, this will error.\nconst notif = new Notification({ linux: true }, true);\nnotif.icon(\"/path/to/icon\");\n\n// This will not error; however, no icon will be displayed on macOS.\nconst notif = new Notification({ linux: true }, false);\nnotif.icon(\"/path/to/icon\");\n```\n\n## FAQ\n\n### Error: Deno.dlopen is not a function\n\nIf you are getting the error \"Deno.dlopen is not a function\" then you likely\nhaven't enabled the unstable ffi features when running your code. **Please run\nwith the `--unstable` flag.** (You might also need the `--allow-ffi` flag).\n\n#### Reason\n\nThis library relies on native (Rust) libraries to launch notifications. However,\nDeno hasn't yet stabilized foreign function interfaces (which allow Deno to call\nthese native libraries). To allow running these unstable features, you must\nexplictly tell Deno to allow calls to the unstable `Deno.dlopen` function.\n\n### Installing Manually\n\nBy default, the ffi library will automatically be downloaded via\n[Plug](https://github.com/denosaurs/plug) to match your `deno_notify` version.\n\nHowever, in some cases you may want to refer to a local version of the library\nfiles. To do so, you can set the environment variable `NOTIFY_PLUGIN_URL` to the\npath of the library file(s).\n\nYou can set the environment variable via command line, or directly through Deno\nvia `Deno.env.set()`. (Note that you must import `deno_notify` **after** having\nset the environment variable for this option to take effect).\n\n### Known Issues\n\n- Many platform-specific features are not implemented\n  - Features like actions, hints, etc.\n  - Need to integrate new mac-notification-sys changes into notify-rust\n- Icons/app_id on macOS are not implemented because of following issues:\n  - Custom app icons are only applied if the notification requesting it is the\n    first one being sent on mac\n    - This means an app icon cannot be changed once set, and cannot be changed\n      even if it wasn't set in the first one.\n  - Using a custom app icon on mac sometimes crashes\n    - From my own experience, this seems to happen with non-system applications\n    - [See this GitHub issue for more information](https://github.com/h4llow3En/mac-notification-sys/issues/8)\n\n## Contributing\n\nPull request, issues and feedback are very welcome. Code style is formatted\nusing `deno fmt -c deno.jsonc`. When adding new features, please also add\n[tests](https://deno.land/manual/testing) in the `tests` directory.\n\n## Acknowledgments\n\n- Notification system from [notify-rust](https://github.com/hoodie/notify-rust)\n- Plugin import from [Plug](https://github.com/denosaurs/plug)\n","funding_links":[],"categories":["基础设施"],"sub_categories":["Deno 源"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPandawan%2Fdeno_notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPandawan%2Fdeno_notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPandawan%2Fdeno_notify/lists"}