All Projects → coderaiser → Smalltalk

coderaiser / Smalltalk

Licence: mit
Promise-based Alert, Confirm and Prompt replacement

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Smalltalk

Vuejs Dialog
A lightweight, promise based alert, prompt and confirm dialog
Stars: ✭ 327 (+330.26%)
Mutual labels:  prompt, promise, alert, confirm
Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+2428.95%)
Mutual labels:  prompt, modal, alert, confirm
jquery.dialog.js
A lightweight replacement for the browser's default dialog boxes.
Stars: ✭ 17 (-77.63%)
Mutual labels:  alert, modal, prompt, confirm
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (-46.05%)
Mutual labels:  alert, modal, prompt, confirm
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (+1546.05%)
Mutual labels:  modal, alert, confirm
Ng Popups
🎉 Alert, confirm and prompt dialogs for Angular. Simple as that.
Stars: ✭ 80 (+5.26%)
Mutual labels:  prompt, modal, alert
Wc Messagebox
基于 Vue 2.0 开发的 Alert, Toast, Confirm 插件, UI仿照 iOS 原生
Stars: ✭ 203 (+167.11%)
Mutual labels:  modal, alert, confirm
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+8018.42%)
Mutual labels:  prompt, alert, confirm
Vue Simple Alert
Simple alert(), confirm(), prompt() for Vue.js
Stars: ✭ 93 (+22.37%)
Mutual labels:  prompt, alert, confirm
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+18227.63%)
Mutual labels:  prompt, alert, confirm
ax5ui-dialog
Javascript UI Component - Dialog - JavaScript Dialog / Bootstrap Dialog
Stars: ✭ 29 (-61.84%)
Mutual labels:  alert, prompt, confirm
mobile-message
基于移动端的弹窗组件,默认提供info、success、warning、error、alert、confirm、multiple、vertical、bottomSheet、prompt,可自定义弹窗。它可以包含任何Html内容可以自定义弹窗的样式,也可以加入自定以的弹窗动画。
Stars: ✭ 13 (-82.89%)
Mutual labels:  alert, prompt, confirm
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (+28.95%)
Mutual labels:  alert, prompt, confirm
React Native Alert Pro
The Pro Version of React Native Alert (Android & iOS)
Stars: ✭ 69 (-9.21%)
Mutual labels:  modal, alert, confirm
Fsm As Promised
A finite state machine library using ES6 promises
Stars: ✭ 446 (+486.84%)
Mutual labels:  hacktoberfest, promise
Overhang.js
🔔 A jQuery plugin for notifications, prompts and confirmations.
Stars: ✭ 437 (+475%)
Mutual labels:  prompt, alert
Xonsh
🐚 Python-powered, cross-platform, Unix-gazing shell
Stars: ✭ 5,327 (+6909.21%)
Mutual labels:  prompt, hacktoberfest
Sweetalert
A beautiful replacement for JavaScript's "alert"
Stars: ✭ 21,871 (+28677.63%)
Mutual labels:  modal, alert
Cleanymodal
Swift UI Kit to present clean modal/alert
Stars: ✭ 437 (+475%)
Mutual labels:  modal, alert
Ngx Sweetalert2
Declarative, reactive, and template-driven SweetAlert2 integration for Angular
Stars: ✭ 503 (+561.84%)
Mutual labels:  modal, alert

Smalltalk License NPM version Dependency Status Build Status Coverage

Simple Promise-based replacement of native Alert, Confirm and Prompt.

Install

npm i smalltalk

API

First things first, require smalltalk with:

const smalltalk = require('smalltalk');

You can also use native version with:

const smalltalk = require('smalltalk/native');

In every method of smalltalk last parameter options is optional and could be used to prevent handling of cancel event and to specify custom button label.

({
    cancel: true, /* default */
});

smalltalk.alert(title, message [, options])

Alert

smalltalk
    .alert('Error', 'There was an error!')
    .then(() => {
        console.log('ok');
    });

smalltalk.confirm(title, message [, options])

Confirm

smalltalk
    .confirm('Question', 'Are you sure?')
    .then(() => {
        console.log('yes');
    })
    .catch(() => {
        console.log('no');
    });

smalltalk.prompt(title, message, value [, options])

Prompt

smalltalk
    .prompt('Question', 'How old are you?', '10')
    .then((value) => {
        console.log(value);
    })
    .catch(() => {
        console.log('cancel');
    });

Use type='password' for password fields:

smalltalk
    .prompt('Question', 'How old are you?', '10', {
        type: 'password',
    })
    .then((value) => {
        console.log(value);
    })
    .catch(() => {
        console.log('cancel');
    });

smalltalk.progress(title, message)

Progress

const progress = smalltalk.progress('Cloud Commander', 'Copy /home/coderaiser -> /home/coderaiser/2');

progress.setProgress(41)
    .catch(() => {
        console.log('abort');
    });

Custom label

You can use custom label passing into options param the buttons specification. For example :

const tryToCatch = require('try-to-catch');
const OK = 2;
const result = await tryToCatch(smalltalk.confirm, 'Question', 'Are you sure?', {
    buttons: {
        ok: 'Ok Label',
        cancel: 'Cancel Label',
    },
});

if (result.length === OK)
    console.log('yes');
else
    console.log('no');

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].