{"id":29189423,"url":"https://github.com/coderaiser/smalltalk","last_synced_at":"2025-07-01T23:07:42.277Z","repository":{"id":39886416,"uuid":"42772106","full_name":"coderaiser/smalltalk","owner":"coderaiser","description":"Promise-based Alert, Confirm and Prompt replacement","archived":false,"fork":false,"pushed_at":"2023-12-03T21:37:27.000Z","size":405,"stargazers_count":90,"open_issues_count":12,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-21T01:12:51.829Z","etag":null,"topics":["alert","confirm","hacktoberfest","modal","promise","prompt"],"latest_commit_sha":null,"homepage":"","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/coderaiser.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","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":"2015-09-19T12:35:25.000Z","updated_at":"2025-02-16T07:35:17.000Z","dependencies_parsed_at":"2024-06-18T14:07:52.145Z","dependency_job_id":"614ae28f-6717-4a40-83b3-acb7d646e798","html_url":"https://github.com/coderaiser/smalltalk","commit_stats":{"total_commits":385,"total_committers":6,"mean_commits":64.16666666666667,"dds":"0.34805194805194806","last_synced_commit":"4ec182ac0d4b80474892e780c9af11bc3242e70b"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/coderaiser/smalltalk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fsmalltalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fsmalltalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fsmalltalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fsmalltalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderaiser","download_url":"https://codeload.github.com/coderaiser/smalltalk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fsmalltalk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261050705,"owners_count":23102557,"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":["alert","confirm","hacktoberfest","modal","promise","prompt"],"created_at":"2025-07-01T23:07:41.483Z","updated_at":"2025-07-01T23:07:42.157Z","avatar_url":"https://github.com/coderaiser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smalltalk [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage][CoverageIMGURL]][CoverageURL]\n\nSimple [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise)-based replacement of native Alert, Confirm and Prompt.\n\n# Install\n\n```\nnpm i smalltalk\n```\n\n# API\n\nFirst things first, require `smalltalk` with:\n\n```js\nconst smalltalk = require('smalltalk');\n```\n\nYou can also use native version with:\n\n```js\nconst smalltalk = require('smalltalk/native');\n```\n\nWhen you need a bundled verseion use\n\n```js\nimport smalltalk from 'smalltalk/bundle';\n```\n\nIn every method of `smalltalk` last parameter *options* is optional and could be used\nto prevent handling of cancel event and to specify custom button label.\n\n```js\n({\n    cancel: true, /* default */\n});\n```\n\n## smalltalk.alert(title, message [, options])\n\n![Alert](https://raw.githubusercontent.com/coderaiser/smalltalk/master/screen/alert.png \"Alert\")\n\n```js\nsmalltalk\n    .alert('Error', 'There was an error!')\n    .then(() =\u003e {\n        console.log('ok');\n    });\n```\n\n## smalltalk.confirm(title, message [, options])\n\n![Confirm](https://raw.githubusercontent.com/coderaiser/smalltalk/master/screen/confirm.png \"Confirm\")\n\n```js\nsmalltalk\n    .confirm('Question', 'Are you sure?')\n    .then(() =\u003e {\n        console.log('yes');\n    })\n    .catch(() =\u003e {\n        console.log('no');\n    });\n```\n\n## smalltalk.prompt(title, message, value [, options])\n\n![Prompt](https://raw.githubusercontent.com/coderaiser/smalltalk/master/screen/prompt.png \"Prompt\")\n\n```js\nsmalltalk\n    .prompt('Question', 'How old are you?', '10')\n    .then((value) =\u003e {\n        console.log(value);\n    })\n    .catch(() =\u003e {\n        console.log('cancel');\n    });\n```\n\nUse `type='password'` for `password` fields:\n\n```js\nsmalltalk\n    .prompt('Question', 'How old are you?', '10', {\n        type: 'password',\n    })\n    .then((value) =\u003e {\n        console.log(value);\n    })\n    .catch(() =\u003e {\n        console.log('cancel');\n    });\n```\n\n## smalltalk.progress(title, message)\n\n![Progress](https://raw.githubusercontent.com/coderaiser/smalltalk/master/screen/progress.png \"Progress\")\n\n```js\nconst progress = smalltalk.progress('Cloud Commander', 'Copy /home/coderaiser -\u003e /home/coderaiser/2');\n\nprogress\n    .setProgress(41)\n    .catch(() =\u003e {\n        console.log('abort');\n    });\n```\n\n## Custom label\n\nYou can use custom label passing into options param the buttons specification. For example :\n\n```js\nconst tryToCatch = require('try-to-catch');\nconst OK = 2;\nconst result = await tryToCatch(smalltalk.confirm, 'Question', 'Are you sure?', {\n    buttons: {\n        ok: 'Ok Label',\n        cancel: 'Cancel Label',\n    },\n});\n\nif (result.length === OK)\n    console.log('yes');\nelse\n    console.log('no');\n```\n\n# License\n\nMIT\n\n[NPMIMGURL]: https://img.shields.io/npm/v/smalltalk.svg?style=flat\u0026longCache=true\n[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/smalltalk/master.svg?style=flat\u0026longCache=true\n[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\u0026longCache=true\n[NPMURL]: https://npmjs.org/package/smalltalk \"npm\"\n[BuildStatusURL]: https://travis-ci.org/coderaiser/smalltalk \"Build Status\"\n[LicenseURL]: https://tldrlegal.com/license/mit-license \"MIT License\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/smalltalk?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/smalltalk/badge.svg?branch=master\u0026service=github\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fsmalltalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderaiser%2Fsmalltalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fsmalltalk/lists"}