Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Latest commit

 

History

History
239 lines (168 loc) · 7.88 KB

generator.md

File metadata and controls

239 lines (168 loc) · 7.88 KB

Generator

Kind: global class

new Generator(config)

Represents a Generator

Param Type Description
config object The configuration object (optional)

generator.configure(config) ⇒

Adds configuration properties

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
config object The configuration object

generator.addIgnoredOperations(operationNames) ⇒

Adds known ignored operation names

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
operationNames Array.<string> The list of operation names

generator.addIgnoredParameters(parameterNames) ⇒

Adds known ignored parameters names

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
parameterNames Array.<string> The list of parameter names

generator.setModules(parameters) ⇒

Sets the internal Modules object to use for resolving modules

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
parameters Array.<string> The list of parameter names

generator.use(moduleNamesOrObjects) ⇒

Loads modules and their dependencies

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
moduleNamesOrObjects Array.<string> | Array.<object> Module objects or names to load

generator.emit(phase, event, data) ⇒

Emits an event for a given specification scope.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
phase string The phase name
event string The event name
data object The data object to emit

generator.on(phase, event, data) ⇒

Registers a listener for a given phase and event.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
phase string The phase name
event string The event name
data object The data object to emit

generator.onPrepare(event, listener) ⇒

Shorthand method to register a listener for 'prepare' phase and given event.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
event string The event name
listener function The callback listener function

generator.onDecorate(event, listener) ⇒

Shorthand method to register a listener for 'decorate' phase and given event.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
event string The event name
listener function The callback listener function

generator.onFinalize(event, listener) ⇒

Shorthand method to register a listener for 'finalize' phase and given event.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
event string The event name
listener function The callback listener function

generator.write(event, data) ⇒

Emits a write event

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
event string The event name
data object The data to write

generator.onWrite(event, listener) ⇒

Shorthand method to register a write listener for given event.

Kind: instance method of Generator
Returns: same instance to allow chaining

Param Type Description
event string The event name
listener function The callback listener function

generator.process(specs, references)

Processes the specification.

Kind: instance method of Generator

Param Type Description
specs object | Array.<object> One or many specifications loaded by the Loader
references object (Optional) A manually loaded set of references

generator.groupOperation(operation) ⇒

Internal hook that determines the resource and group names for grouping. This method can be overriden with by custom logic.

Kind: instance method of Generator
Returns: the resource and group names object.

Param Type Description
operation object The operation object

generator.groupSort(group) ⇒

Internal hook that returns a order index used to sort group names. This method can be overriden with by custom logic.

Kind: instance method of Generator
Returns: the sort index based on the group name

Param Type Description
group string The group name

generator.operationSort(operation) ⇒

Internal hook that returns a order index used to sort operations. This method can be overriden with by custom logic. This implementation sorts by length of the URI after variables are stripped out.

Kind: instance method of Generator
Returns: the sort index based on the operation

Param Type Description
operation object The operation object