SuperScript

This documentation is still being written. Please bear with us while we complete this documentation.

Modifiers

Modifiers refers to a family of classes which are employed by an emitter to modify the declarations prior to the output being emitted.

Each type of modifier is implemented at a different stage of the emitter pipeline. Consequently, a different form of the declarations is made available to each type of modifier.

Emitters can be thought of as a pipeline through which declarations are passed

The above image shows that each type of emitter runs at a different stage in the emitting process and is passed the output of the previous stage.

Processing Declarations

The emitter pipeline offers four opportunities to modify the client-side form of the emitter-specific collection of declarations:

  • CollectionPreModifier

    The first stage in the emitter pipeline is passed the raw, currently-unmodified collection of DeclarationBase objects, and returns a collection of DeclarationBase objects.

    Read about the CollectionPreModifier here.

    View this class on GitHub

  • CollectionConverter

    The second stage in the emitter pipeline takes the output from the first stage, a collection of DeclarationBase objects, and uses the internal logic of the specific implementation of DeclarationBase to convert this server-side object into its client-side form.

    The output of this stage is a string consisting of the concatenated output from all instances of DeclarationBase passed to this emitter.

    Read about the CollectionConverter here.

    View this class on GitHub

  • CollectionPostModifier

    The next stage in the emitter pipeline takes the output from the second stage and offers the opportunity to modify the client-side form of the declarations passed to this emitter.

    An example of the advantage which this stage offers is the possibility to minify JavaScript or to pre-compile HTML templates.

    Read about the CollectionPostModifier here.

    View this class on GitHub

The final step implemented by an emitter uses an instance of an HtmlWriter to write the output to the webpage. In actuality, this still offers the opportunity to modify the output.

  • HtmlWriter

    The HtmlWriter is passed a string and returns an IHtmlString.

    However, this stage offers the opportunity to write the passed string to one location and write out something entirely different to the emitting location.

    For example, this stage could write the passed string to the local file system as a *.js file, then write a <script src="…"> tag to the webpage which references the created *.js file.

    Read about the HtmlWriter here.

    View this class on GitHub

What Next?

Read about pre-conversion modifiers here.

Read about collection converters here.

Read about post-conversion modifiers here.

Read about HTML writers here.