Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

yeoman promise

// at the begining of method call: const done = this.async()
// when you are done call: done()
//
// for example:
//

const Generator = require('yeoman-generator')

const questions = [
    { type: 'input',
      name: 'name',
      message: 'What is the name of this form?',
      default: 'someForm'
    }
]

const names = [
 {
   type: 'input',
   name: 'inputs',
   message: 'What is the name of the input?',
   default: '.input'
 },
 {
   type: 'confirm',
   name: 'another',
   message: "Is there another input?",
   default: true
 }
]

const inputs = []

class Form extends Generator {

  prompting2 () {
     const done = this.async()
     return this.prompt(names).then((answers) => {
      inputs.push(answers.inputs)
      if (answers.another) this.prompting2()
      else {
       this.inputs = inputs
       this.log(this.inputs)
       done()
      }
    })
  }

}

module.exports = Form
Comment

PREVIOUS NEXT
Code Example
Javascript :: mdn 
Javascript :: manipulação de array javascript 
Javascript :: flutter app accessible when phone is locked 
Javascript :: how to know if express is intalled 
Javascript :: aba translate js 
Javascript :: create react app cloudfront invalidation 
Javascript :: js remove plus 
Javascript :: input type shows object angularjs 
Javascript :: whait till src img has loaded angular 
Javascript :: ngx-search clearing-imp 
Javascript :: insert html block and dynamic content 
Javascript :: how to get the data from clicking on notification on web in reactjs 
Javascript :: lesson-3 
Javascript :: javascript .addListener( set custom parameters 
Javascript :: Pinterest Javascript 
Javascript :: Minimize DOM access - JavaScript 
Javascript :: how to pass an id to the route of a seprate file react 
Javascript :: firebase update return result 
Javascript :: react testing library getBy image 
Javascript :: reorder them so that more specific routes come before less specific routes 
Javascript :: display prety html json data 
Javascript :: nodejs hpp github 
Javascript :: add single quote in Innerhtml javascript string 
Javascript :: Cannot load gulp: ReferenceError: primordials is not defined 
Javascript :: Shorthand for calling functions conditionally 
Javascript :: cproblem upgrading node on windws 
Javascript :: how to log message with replacing placeholders in the string in js 
Javascript :: Get Multipal Tab Value to One App Script 
Javascript :: js match property 
Javascript :: vscode autosuggest background 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =