Each item here represents a method that page/middleware objects may override.
The keys here are method names.
The values are tuples containing:
- Default implementation of the method.
- Normalization function applied to method output.
Note that each of these methods receives an argument, which is the next
implementation of the method in the call chain.
- Middleware implementations should call this in most cases.*
- Page implementations may call this (it will be the default implementation).
- Consider carefully before deciding not to call
next()
in middleware.
Other middleware (and the page itself) may exhibit undefined behavior if a
given method is not called. Generally, only skip calling next()
for
short-circuit responses (e.g. a redirect from handleRoute
).
var PAGE_METHODS = {
handleRoute : [() => ({code: 200}), Q],
getContentType : [() => "text/html; charset=utf-8", _ => _],
getHeaders : [() => [], Q],
getTitle : [() => "", Q],
getScripts : [() => [], standardizeScripts],
getSystemScripts : [() => [], standardizeScripts],
getBodyStartContent: [() => [], Q],
getHeadStylesheets : [() => [], standardizeStyles],
getDebugComments : [() => [], standardizeDebugComments],
getMetaTags : [() => [], standardizeMetaTags],
getLinkTags : [() => [], standardizeLinkTags],
getBase : [() => null, Q],
getBodyClasses : [() => [], Q],
getElements : [() => [], standardizeElements],
getResponseData : [() => "", Q],
};