{"id":17750618,"url":"https://github.com/nuintun/toast","last_synced_at":"2025-04-01T09:39:23.411Z","repository":{"id":42218818,"uuid":"59626356","full_name":"nuintun/toast","owner":"nuintun","description":"A toast plugin","archived":false,"fork":false,"pushed_at":"2017-12-18T08:20:42.000Z","size":730,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2023-04-05T13:38:12.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nuintun.github.io/toast","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/nuintun.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-05-25T03:01:58.000Z","updated_at":"2016-11-28T02:51:03.000Z","dependencies_parsed_at":"2022-08-27T10:42:00.995Z","dependency_job_id":null,"html_url":"https://github.com/nuintun/toast","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuintun%2Ftoast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuintun%2Ftoast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuintun%2Ftoast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuintun%2Ftoast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuintun","download_url":"https://codeload.github.com/nuintun/toast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246620144,"owners_count":20806716,"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-10-26T12:22:53.641Z","updated_at":"2025-04-01T09:39:23.386Z","avatar_url":"https://github.com/nuintun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toast\n\n\u003e A toast plugin\n\n### Usage\n\n```js\nnew Toast('言宜慢，心宜善。');\n\nnew Toast('言宜慢，心宜善。', { type: 'smile', lock: true });\n\nfunction handler() {\n  console.log('提示类型：', this.type, '\u003e\u003e\u003e', '触发事件：', arguments[0], '\u003e\u003e\u003e', '回调参数：', arguments[1]);\n}\n\nToast.loading('正在加载数据...', { lock: true })\n  .on('hide', function() {\n    Toast.success('言宜慢，心宜善。')\n      .on('show', handler)\n      .on('hide', handler);\n  })\n  .on('lock', handler)\n  .on('unlock', handler);\n```\n\n### API\n\n#### new Toast(message, options) `constructor`\n\n##### _message_ `String` 消息文本\n\n##### _options_ `Object` 配置提示框参数\n\n* id `Number | String`\n\n  提示框身份标识，相同身份标识的提示框不能共存。\n\n* lock `Boolean`\n\n  是否打开锁屏遮罩，默认 `false`。\n\n* type `String`\n\n  提示框类型，用以展示不同图标和主题，内置有\n  `info success warn error smile lock sad ask loading`。\n\n* timeout `Object`\n\n  自动关闭提示框时间，默认 `3000` 毫秒，如果为 `0` 则不关闭提示框。\n\n#### attribute \u0026 method `attribute \u0026 method`\n\n##### id `attribute` 提示框身份标识 `readonly`\n\n##### locked `attribute` 提示框锁定状态 `readonly`\n\n##### visibility `attribute` 提示框可见状态 `readonly`\n\n##### type `attribute` 提示框类型 `readonly`\n\n##### show `method` 显示提示框并触发 `show` 事件，参数可选\n\n##### hide`method` 隐藏提示框并触发 `hide` 事件，参数可选\n\n##### lock`method` 显示遮罩层并触发 `lock` 事件，参数可选\n\n##### unlock `method` 隐藏遮罩层并触发 `unlock` 事件，参数可选\n\n##### on`method` 绑定事件监听\n\n##### off `method` 移除事件监听\n\n##### emit `method` 触发事件回调\n\n#### static method `method`\n\n##### Toast.query`method` 根据身份标识获取提示框实例\n\n##### Toast.success `method` 成功提示框\n\n##### Toast.error `method` 错误提示框\n\n##### Toast.info `method` 消息提示框\n\n##### Toast.ask `method` 询问提示框\n\n##### Toast.warn `method` 警告提示框\n\n##### Toast.loading `method` 加载提示框\n\n### Demo\n\n#### [在线实例](https://nuintun.github.io/toast/toast.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuintun%2Ftoast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuintun%2Ftoast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuintun%2Ftoast/lists"}