{"id":21941853,"url":"https://github.com/se-panfilov/mini-toastr","last_synced_at":"2025-04-12T19:48:02.714Z","repository":{"id":55858273,"uuid":"70707233","full_name":"se-panfilov/mini-toastr","owner":"se-panfilov","description":"Small non-blocking notification library. No dependencies","archived":false,"fork":false,"pushed_at":"2024-12-12T22:08:39.000Z","size":14194,"stargazers_count":97,"open_issues_count":21,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T19:47:45.937Z","etag":null,"topics":["javascript","messages","notifications","toast-message","toast-notifications","toastr"],"latest_commit_sha":null,"homepage":"https://se-panfilov.github.io/mini-toastr/","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/se-panfilov.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,"publiccode":null,"codemeta":null}},"created_at":"2016-10-12T14:19:41.000Z","updated_at":"2024-12-12T22:08:44.000Z","dependencies_parsed_at":"2025-01-02T17:15:58.805Z","dependency_job_id":null,"html_url":"https://github.com/se-panfilov/mini-toastr","commit_stats":{"total_commits":232,"total_committers":7,"mean_commits":"33.142857142857146","dds":0.5344827586206897,"last_synced_commit":"e6bfd22a7011f22045d727ca41e880cf1c805d22"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se-panfilov%2Fmini-toastr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se-panfilov%2Fmini-toastr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se-panfilov%2Fmini-toastr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/se-panfilov%2Fmini-toastr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/se-panfilov","download_url":"https://codeload.github.com/se-panfilov/mini-toastr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625497,"owners_count":21135513,"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":["javascript","messages","notifications","toast-message","toast-notifications","toastr"],"created_at":"2024-11-29T03:15:10.113Z","updated_at":"2025-04-12T19:48:02.685Z","avatar_url":"https://github.com/se-panfilov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Codacy Badge](https://api.codacy.com/project/badge/Grade/43efe3dd02c047f39bb3435e9c577092)](https://www.codacy.com/app/se-panfilov/mini-toastr?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=se-panfilov/mini-toastr\u0026amp;utm_campaign=Badge_Grade)\n[![bitHound Overall Score](https://www.bithound.io/github/se-panfilov/mini-toastr/badges/score.svg)](https://www.bithound.io/github/se-panfilov/mini-toastr) [![bitHound Code](https://www.bithound.io/github/se-panfilov/mini-toastr/badges/code.svg)](https://www.bithound.io/github/se-panfilov/mini-toastr)\n[![Code Climate](https://codeclimate.com/github/se-panfilov/mini-toastr/badges/gpa.svg)](https://codeclimate.com/github/se-panfilov/mini-toastr)\n[![Build Status](https://travis-ci.org/se-panfilov/mini-toastr.svg?branch=master)](https://travis-ci.org/se-panfilov/mini-toastr)\n[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/se-panfilov/mini-toastr/blob/master/LICENSE)\n\n[![NPM](https://nodei.co/npm/mini-toastr.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/mini-toastr/)\n[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n[![Package Quality](http://npm.packagequality.com/badge/mini-toastr.png)](http://packagequality.com/#?package=mini-toastr)\n\n# mini-toastr\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/se-panfilov/mini-toastr.svg)](https://greenkeeper.io/)\n\n**mini-toastr** - it's a small non-blocking notification library. No dependencies.\n\n[Demo][2]\n\n================\n\n## Instalation\n\n1. Install\n\nvia npm:\n\n```shell\nnpm i mini-toastr --save\n```\n\nor download [latest release][1]\n\n2. Include in project\n\ninclude in project:\n\n\n```JS\nimport miniToastr from 'mini-toastr' //ES6\n```\n\n3. Init\n\n```JS\nminiToastr.init()// config can be passed here miniToastr.init(config)\n```\n\n## Usage\n\n```JS\nminiToastr.success(message, title, timeout, cb, config)\nminiToastr.info(message, title, timeout, cb, config)\nminiToastr.warn(message, title, timeout, cb, config)\nminiToastr.error(message, title, timeout, cb, config)\n```\n\n*Attention:* You can specify your own types in global config: `miniToastr.init({types: {debug: 'debug'}})` and use it - `miniToastr.debug(message, title, timeout, cb, config)`\n\n## Methods arguments\n\n| Name | Type | Default | Required | Description |\n|---|---|---|---|---|\n| `message` | `String` | `undefined` | Yes | Message in notification |\n| `title` | `String` | `undefined` | No | Title for notification |\n| `timeout` | `Number` | `3000` | No | Time before notification gone |\n| `cb` | `Function` | `undefined` | No | Callback function |\n| `config` | `Object` | `undefined` | No | Local config for this menthod call |\n\n## Global config\n\nYou can specify global config.\n\nHere is default config:\n\n\n```JS\nconst defaultConfig = {\n    types: TYPES,\n    animation: fadeOut,\n    timeout: 3000,\n    appendTarget: document.body,\n    node: document.createElement('div'),\n    style: {\n      //Styles\n    }\n  }\n```\n\n| Name | Type | Default  | Description |\n|---|---|---|---|\n| `types` | `Object` | `{error: 'error', warn: 'warn', success: 'success', info: 'info'}` | List of methods that would be accessable via `miniToastr` i.e. `miniToastr.success()`, `miniToastr.info()`, etc |\n| `animation` | `Function` | `fadeOut` | Function for remove notification. Can be overrrided |\n| `timeout` | `Number` | `3000` | Notification time of life |\n| `appendTarget` | `Node` | `document.body` | Dom element that miniToastr will be attached to |\n| `node` | `Node` | `document.createElement('div')` | Dom element for notification's container |\n| `style` | `Object` | Object of objects | Styles that would be applyied for notifications (after they wuld be translated from `js` to `css`  |\n\n# Notifications structure\n\n```HTML\n\u003c!-- Container--\u003e\n\u003cdiv id=\"mini-toastr\" class=\"mini-toastr\"\u003e\n\n    \u003c!-- Notification 1--\u003e\n    \u003cdiv class=\"mini-toastr__notification -error\"\u003e\n        \u003cdiv class=\"mini-toastr-notification__title\"\u003eMy Title\u003c/div\u003e\n        \u003cdiv class=\"mini-toastr-notification__message\"\u003eMy message\u003c/div\u003e\n    \u003c/div\u003e\n\n    \u003c!-- Notification 2--\u003e\n    \u003cdiv class=\"mini-toastr__notification -success\"\u003e\n        \u003cdiv class=\"mini-toastr-notification__title\"\u003eMy Title 2\u003c/div\u003e\n        \u003cdiv class=\"mini-toastr-notification__message\"\u003eMy message 2\u003c/div\u003e\n    \u003c/div\u003e\n\n    \u003c!-- Notification 3--\u003e\n    \u003cdiv class=\"mini-toastr__notification -warning\"\u003e\n        \u003cdiv class=\"mini-toastr-notification__title\"\u003eMy Title 3\u003c/div\u003e\n        \u003ci class=\"your_class mini-toastr-notification__icon\"\u003e\u003c/i\u003e \u003c!-- You're able to use \"img\"or whatever instead--\u003e\n        \u003cdiv class=\"mini-toastr-notification__message\"\u003eMy message 3\u003c/div\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\nYou can override those classes in your styles or in global config:\n\n```JS\nminiToastr.init({\n    style: {\n        'mini-toastr__notification': {\n          'mini-toastr-notification__message': {\n              'border-radius': '5px',\n              color: 'red'\n          }\n        }\n    }\n})\n```\n\n## Adding an icon\n\nYou're able to add icons\n\n```javascript\n//You can use any font icon\nminiToastr.setIcon('error', 'i', {'class': 'fa fa-warning'})\nminiToastr.setIcon('info', 'i', {'class': 'fa fa-info-circle'})\nminiToastr.setIcon('success', 'i', {'class': 'fa fa-check-circle-o'})\n\n//Or image (or any other element)\nminiToastr.setIcon('warn', 'img', {src: 'assets/img/demo-warn.png', style: 'vertical-align: bottom;'})\n```\n\nBasically `setIcon` get 3 params:\n\n - `type`(`String`) - `error`, `info`, `success`, or `warn`. So you can specify each event with custom icon\n - `nodeType`(`String`) - basically what kind of element it's has to be, e.g. `\u003ci\u003e\u003c/i\u003e` or `\u003cimg/\u003e`\n - `attrs`(`Object`) - object with attributes for icon, such as `class`, `style`, or `src` (for `\u003cimg/\u003e`)\n\n Usually you have to set `miniToastr.setIcon()` after `miniToastr.init()` but also you can do it on each toast call.\n\n Keep in mind, that if you will add class like `miniToastr.setIcon('info', 'i', {'class': 'fa fa-info-circle'})`,\n your actual class will be `fa fa-info-circle mini-toastr-notification__icon`.\n\n So you'll be able to customize all the icons with css\n\n\n## Browser support.\nVersions up to `v0.6.6` - All modern browsers (`ES5` support require). See [ECMAScript 5 compliant browsers][3].\nVersions `v0.7.0` and above - browsers with `ES6` support only\n\n## License\n\nMIT License\n\nCopyright (c) 2016 Sergei Panfilov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Legal Disclaimer\n\nThis project is provided \"as is\", without warranty of any kind. The authors and contributors disclaim all liability for any damages arising from its use, inability to use, or performance. Users are responsible for ensuring compliance with applicable laws and regulations in their jurisdiction, including but not limited to:\n\n- European Union: Cyber Resilience Act (CRA) and Artificial Intelligence Act (AI Act)\n- United States: Uniform Commercial Code (UCC) and Export Administration Regulations (EAR)\n- China: Cybersecurity Law\n- India: Information Technology Act\n\nFor details, see the full [DISCLAIMER.md](DISCLAIMER.md) file.\n\n[1]: https://github.com/se-panfilov/mini-toastr/releases\n[2]: https://se-panfilov.github.io/mini-toastr/\n[3]: http://caniuse.com/#feat=es5\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse-panfilov%2Fmini-toastr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fse-panfilov%2Fmini-toastr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse-panfilov%2Fmini-toastr/lists"}