update README

This commit is contained in:
Philipp Kunz 2016-12-10 17:30:04 +01:00
parent 0dae90cc24
commit 256c53b6f9

View File

@ -30,15 +30,15 @@ let myInteract = new SmartInteract([{ // note: its an array. You can specify mul
default: 'Somebody', default: 'Somebody',
validate: (inputString) => { return true } // implement your own validation validate: (inputString) => { return true } // implement your own validation
}]) }])
SmartInteract.addQuestions([ ... ]) // add more questions myInteract.addQuestions([ ... ]) // add more questions
SmartInteract.runQueue() myInteract.runQueue()
.then(answerBucket => { // the bucket has all the answers of the completed queue .then(answerBucket => { // the bucket has all the answers of the completed queue
let answerQuestion1 = answerBucket.getAnswerFor('question1') let answerQuestion1 = answerBucket.getAnswerFor('question1')
// do something with the answers // do something with the answers
}) })
// alternatively use .askQuestion() for more direct control // alternatively use .askQuestion() for more direct control
SmartInteract.askQuestion{ // note: its an array. You can specify multiple questions myInteract.askQuestion{ // note: its an array. You can specify multiple questions
name: 'question2', name: 'question2',
type: 'confirm', type: 'confirm',
message: 'Do you speak English?', message: 'Do you speak English?',