PromptModuleAPI.js 486 B

1234567891011121314151617181920212223
  1. module.exports = class PromptModuleAPI {
  2. constructor (creator) {
  3. this.creator = creator
  4. }
  5. injectFeature (feature) {
  6. this.creator.featurePrompt.choices.push(feature)
  7. }
  8. injectPrompt (prompt) {
  9. this.creator.injectedPrompts.push(prompt)
  10. }
  11. injectOptionForPrompt (name, option) {
  12. this.creator.injectedPrompts.find(f => {
  13. return f.name === name
  14. }).choices.push(option)
  15. }
  16. onPromptComplete (cb) {
  17. this.creator.promptCompleteCbs.push(cb)
  18. }
  19. }