github.com/brycereitano/goa@v0.0.0-20170315073847-8ffa6c85e265/goagen/gen_js/options.go (about)

     1  package genjs
     2  
     3  import "github.com/goadesign/goa/design"
     4  import "time"
     5  
     6  //Option a generator option definition
     7  type Option func(*Generator)
     8  
     9  //API The API definition
    10  func API(API *design.APIDefinition) Option {
    11  	return func(g *Generator) {
    12  		g.API = API
    13  	}
    14  }
    15  
    16  //OutDir Path to output directory
    17  func OutDir(outDir string) Option {
    18  	return func(g *Generator) {
    19  		g.OutDir = outDir
    20  	}
    21  }
    22  
    23  //Timeout Timeout used by JavaScript client when making requests
    24  func Timeout(timeout time.Duration) Option {
    25  	return func(g *Generator) {
    26  		g.Timeout = timeout
    27  	}
    28  }
    29  
    30  //Scheme Scheme used by JavaScript client
    31  func Scheme(scheme string) Option {
    32  	return func(g *Generator) {
    33  		g.Scheme = scheme
    34  	}
    35  }
    36  
    37  //Host addressed by JavaScript client
    38  func Host(host string) Option {
    39  	return func(g *Generator) {
    40  		g.Host = host
    41  	}
    42  }
    43  
    44  //NoExample Do not generate an HTML example file
    45  func NoExample(noExample bool) Option {
    46  	return func(g *Generator) {
    47  		g.NoExample = noExample
    48  	}
    49  }