{"id":18888021,"url":"https://github.com/codex-team/js-notifier","last_synced_at":"2025-08-22T00:31:19.860Z","repository":{"id":57202545,"uuid":"95469357","full_name":"codex-team/js-notifier","owner":"codex-team","description":"Notifications for websites","archived":false,"fork":false,"pushed_at":"2020-10-10T11:43:41.000Z","size":173,"stargazers_count":49,"open_issues_count":2,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-23T17:32:41.634Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codex-team.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":"2017-06-26T17:01:19.000Z","updated_at":"2024-04-10T00:54:30.000Z","dependencies_parsed_at":"2022-09-06T10:51:03.612Z","dependency_job_id":null,"html_url":"https://github.com/codex-team/js-notifier","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/codex-team%2Fjs-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fjs-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fjs-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fjs-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codex-team","download_url":"https://codeload.github.com/codex-team/js-notifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230542288,"owners_count":18242332,"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-08T07:41:26.809Z","updated_at":"2024-12-20T06:06:41.884Z","avatar_url":"https://github.com/codex-team.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript Notifier\n\nLightweight notification module for websites\n\n## Instalation\n\n### Install via NPM/Yarn\n\nInstall package\n\n```shell\nnpm install codex-notifier --save\n```\n\n```shell\nyarn add codex-notifier\n```\n\n#### Require module\n\n```javascript\nconst notifier = require('codex-notifier');\n```\n\n```javascript\nimport notifier from 'codex-notifier';\nimport {ConfirmNotifierOptions, NotifierOptions, PromptNotifierOptions} from 'codex-notifier';\n```\n\n## Usage\n\nModule has only one public method — `show`.\nYou should pass there object with notification properties\n\n#### General properties\n\n- `message` — notification message (can contains HTML)\n- `type` — type of notification: `alert`, `confirm` or `prompt`. `Alert` by default\n- `style` — just add `'cdx-notify--' + style` class. We have some default styles: `success` and `error`\n- `time` — notification expire time in ms. Only for `alert` notifies expires (8s by default)\n\n#### Confirm notifications properties\n\n- `okText` — text for confirmation button (*Confirm* by default)\n- `cancelText` — text for cancel button (*Cancel* by default)\n- `okHandler` — fires when *Confirm* button was pressed\n- `cancelHandler` — fires when *Cancel* button was pressed or notification was closed\n\n#### Prompt notifications properties\n\n- `okText` — text for submit button (*Ok* by default)\n- `okHandler` — fires when submit button was pressed. Gets input's value as a parameter\n- `cancelHandler` — fires when notification was closed\n- `placeholder` — input placeholder\n- `default` — input default value\n- `inputType` — type of input  (text by default)\n\n## Examples\n\n```javascript\nnotifier.show({\n  message: 'Refresh the page'\n})\n```\n\n![Notify](https://github.com/codex-team/js-notifier/raw/master/docs/examples/notify.png)\n\n```javascript\nnotifier.show({\n  message: 'Message was sent',\n  style: 'success',\n  time: 5000\n})\n```\n\n![Success](https://github.com/codex-team/js-notifier/raw/master/docs/examples/success.png)\n\n```javascript\nnotifier.show({\n  message: 'Sorry, server is busy now',\n  style: 'error'\n})\n```\n\n![Error](https://github.com/codex-team/js-notifier/raw/master/docs/examples/error.png)\n\n```javascript\nnotifier.show({\n  message: 'Delete account?',\n  type: 'confirm',\n  okText: 'Yes',\n  cancelText: 'Oh, wait',\n  okHandler: account.delete\n})\n```\n\n![Confirm](https://github.com/codex-team/js-notifier/raw/master/docs/examples/confirm.png)\n\n```javascript\nnotifier.show({\n  message: 'Enter your email',\n  type: 'prompt',\n  okText: 'Enter',\n  okHandler: checkEmail,\n  inputType: 'email',\n  placeholder: 'team@ifmo.su'\n})\n```\n\n![Prompt](https://github.com/codex-team/js-notifier/raw/master/docs/examples/prompt.png)\n\n## Custom styles\n\nYou can easily customize notifications appearance. Read more about it [here](https://github.com/codex-team/js-notifier/blob/master/docs/styles.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex-team%2Fjs-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodex-team%2Fjs-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex-team%2Fjs-notifier/lists"}