HotStaq
Class: HotStaq
The main class that handles all HTML preprocessing, then outputs the results.
Implements​
Table of contents​
Constructors​
Properties​
- api
- apiContent
- components
- files
- hotSite
- logger
- mode
- pageContent
- pages
- publicSecrets
- testerAPI
- testerApiContent
- testers
- isReadyForTesting
- isWeb
- onReadyForTesting
Methods​
- addComponent
- addFile
- addPage
- addTester
- createExpressRoutes
- executeAllAPITests
- executeAllWebTests
- executeTests
- generateContent
- getAPITestingMaps
- getComponent
- getFile
- getPage
- getRouteFromName
- getRouteKeyFromName
- getWebTestingMaps
- loadHotFiles
- loadHotSite
- process
- registerComponent
- addHtml
- checkHotSiteName
- displayContent
- displayUrl
- getParam
- getParamDefault
- getValueFromHotSiteObj
- onReady
- parseBoolean
- processContent
- processLocalFile
- processUrl
- replaceKey
- useOutput
- wait
- waitForTesters
Constructors​
constructor​
• new HotStaq(copy?
)
Parameters​
Name | Type |
---|---|
copy | IHotStaq |
Defined in​
Properties​
api​
• api: HotAPI
The api that's used to communicate with.
Implementation of​
Defined in​
apiContent​
• apiContent: string
The api content to use when about to load HotStaq.
Defined in​
components​
• components: Object
The components that can be constructed.
Index signature​
â–ª [name: string
]: HotComponent
Implementation of​
Defined in​
files​
• files: Object
The files that can be stored for later use.
Index signature​
â–ª [name: string
]: HotFile
Implementation of​
Defined in​
hotSite​
• hotSite: HotSite
The loaded hotsite.
Implementation of​
Defined in​
logger​
• logger: HotLog
The logger.
Defined in​
mode​
• mode: DeveloperMode
Indicates what type of execution this is.
Implementation of​
Defined in​
pageContent​
• pageContent: string
The page content to use when about to load HotStaq.
Defined in​
pages​
• pages: Object
The pages that can be constructed.
Index signature​
â–ª [name: string
]: HotPage
Implementation of​
Defined in​
publicSecrets​
• publicSecrets: any
The secrets that can be exposed publicly.
Defined in​
testerAPI​
• testerAPI: HotAPI
The tester api that's used to communicate with.
Implementation of​
Defined in​
testerApiContent​
• testerApiContent: string
The tester api content to use when about to load HotStaq.
Defined in​
testers​
• testers: Object
The secrets that can be exposed publicly.
Index signature​
â–ª [name: string
]: HotTester
Defined in​
isReadyForTesting​
â–ª Static
isReadyForTesting: boolean
= false
Indicates if this is ready for testing.
Defined in​
isWeb​
â–ª Static
isWeb: boolean
= false
Indicates if this is a web build.
Defined in​
onReadyForTesting​
â–ª Static
onReadyForTesting: () => Promise
<void
> = null
Type declaration​
â–¸ (): Promise
<void
>
Executes this event when this page is ready for testing.
Returns​
Promise
<void
>
Defined in​
Methods​
addComponent​
â–¸ addComponent(component
): void
Add and register a component.
Parameters​
Name | Type |
---|---|
component | HotComponent |
Returns​
void
Defined in​
addFile​
â–¸ addFile(file
): void
Add a file.
Parameters​
Name | Type |
---|---|
file | HotFile |
Returns​
void
Defined in​
addPage​
â–¸ addPage(page
): void
Add a page.
Parameters​
Name | Type |
---|---|
page | HotPage |
Returns​
void
Defined in​
addTester​
â–¸ addTester(tester
): void
Add a tester for use later.
Parameters​
Name | Type |
---|---|
tester | HotTester |
Returns​
void
Defined in​
createExpressRoutes​
â–¸ createExpressRoutes(expressApp
, jsSrcPath?
): void
Create the Express routes from the given pages. Be sure to load the pages first before doing this. This method is meant to be used for customized Express applications. If you wish to use the loaded routes from this HotStaq object with HotHTTPServer, be sure to use the loadHotSite method in HotHTTPServer.
Parameters​
Name | Type | Default value |
---|---|---|
expressApp | any | undefined |
jsSrcPath | string | "./js/HotStaq.js" |
Returns​
void
Defined in​
executeAllAPITests​
â–¸ executeAllAPITests(testerName
): Promise
<void
>
Execute all api tests from the HotSite testing api object.
Parameters​
Name | Type | Description |
---|---|---|
testerName | string | The tester to use to execute tests. |
Returns​
Promise
<void
>
Defined in​
executeAllWebTests​
â–¸ executeAllWebTests(testerName
): Promise
<void
>
Execute all web tests from the HotSite testing web object.
Parameters​
Name | Type | Description |
---|---|---|
testerName | string | The tester to use to execute tests. |
Returns​
Promise
<void
>
Defined in​
executeTests​
â–¸ executeTests(testerName
, mapName
): Promise
<void
>
Execute tests.
Parameters​
Name | Type | Description |
---|---|---|
testerName | string | The tester to use to execute tests. |
mapName | string | The map or maps to use to navigate through tests. |
Returns​
Promise
<void
>
Defined in​
generateContent​
â–¸ generateContent(routeKey
, name?
, url?
, jsSrcPath?
, passArgs?
, args?
): string
Generate the content to send to a client.
Parameters​
Name | Type | Default value |
---|---|---|
routeKey | string | undefined |
name | string | "" |
url | string | "./" |
jsSrcPath | string | "./js/HotStaq.js" |
passArgs | boolean | true |
args | any | null |
Returns​
string
Defined in​
getAPITestingMaps​
â–¸ getAPITestingMaps(): string
[]
Get the list of maps for testing from the HotSite.
Returns​
string
[]
Defined in​
getComponent​
â–¸ getComponent(name
): HotComponent
Get a component to process.
Parameters​
Name | Type |
---|---|
name | string |
Returns​
Defined in​
getFile​
â–¸ getFile(name
): HotFile
Get a file.
Parameters​
Name | Type |
---|---|
name | string |
Returns​
Defined in​
getPage​
â–¸ getPage(pageName
): HotPage
Get a page to process.
Parameters​
Name | Type |
---|---|
pageName | string |
Returns​
Defined in​
getRouteFromName​
â–¸ getRouteFromName(name
): HotSiteRoute
Get a route from a route's name.
Parameters​
Name | Type |
---|---|
name | string |
Returns​
Defined in​
getRouteKeyFromName​
â–¸ getRouteKeyFromName(name
): string
Get a route's key from a route's name.
Parameters​
Name | Type |
---|---|
name | string |
Returns​
string
Defined in​
getWebTestingMaps​
â–¸ getWebTestingMaps(): string
[]
Get the list of maps for testing from the HotSite.
Returns​
string
[]
Defined in​
loadHotFiles​
â–¸ loadHotFiles(files
, forceContentLoading?
): Promise
<void
>
Load an array of files. If a file already has content, it will not be reloaded unless forceContentLoading is set to true.
Parameters​
Name | Type | Default value |
---|---|---|
files | Object | undefined |
forceContentLoading | boolean | false |
Returns​
Promise
<void
>
Defined in​
loadHotSite​
â–¸ loadHotSite(path
): Promise
<void
>
Load from a HotSite.json file. Be sure to load and attach any testers before loading a HotSite.
Parameters​
Name | Type |
---|---|
path | string |
Returns​
Promise
<void
>
Defined in​
process​
â–¸ process(pageName
, args?
): Promise
<string
>
Process a page and get the result.
Parameters​
Name | Type | Default value |
---|---|---|
pageName | string | undefined |
args | any | null |
Returns​
Promise
<string
>
Defined in​
registerComponent​
â–¸ registerComponent(component
): void
Register a component for use as a HTML tag.
Parameters​
Name | Type |
---|---|
component | HotComponent |
Returns​
void
Defined in​
addHtml​
â–¸ Static
addHtml(parent
, html
): HTMLElement
| HTMLElement
[]
Add a new HTML element(s) to the current document.
Parameters​
Name | Type |
---|---|
parent | string | HTMLElement |
html | string | HTMLElement |
Returns​
HTMLElement
| HTMLElement
[]
Defined in​
checkHotSiteName​
â–¸ Static
checkHotSiteName(hotsiteName
, throwException?
): boolean
Check if a HotSite's name is valid.
Parameters​
Name | Type | Default value |
---|---|---|
hotsiteName | string | undefined |
throwException | boolean | false |
Returns​
boolean
Defined in​
displayContent​
â–¸ Static
displayContent(content
, name
, processor?
): Promise
<HotStaq
>
Process and replace the current HTML page with the hott script. This is meant for web browser use only.
Parameters​
Name | Type | Default value |
---|---|---|
content | string | undefined |
name | string | undefined |
processor | HotStaq | null |
Returns​
Promise
<HotStaq
>
Defined in​
displayUrl​
â–¸ Static
displayUrl(url
, name?
, processor?
, args?
): Promise
<HotStaq
>
Process and replace the current HTML page with the hott script from the given url. This is meant for web browser use only.
Parameters​
Name | Type | Default value |
---|---|---|
url | string | HotStartOptions | undefined |
name | string | null |
processor | HotStaq | null |
args | any | null |
Returns​
Promise
<HotStaq
>
Defined in​
getParam​
â–¸ Static
getParam(name
, objWithParam
, required?
, throwException?
): any
Check if a required parameter exists inside an object. If it exists, return the value.
Parameters​
Name | Type | Default value |
---|---|---|
name | string | undefined |
objWithParam | any | undefined |
required | boolean | true |
throwException | boolean | true |
Returns​
any
Defined in​
getParamDefault​
â–¸ Static
getParamDefault(name
, objWithParam
, defaultValue
): any
Check if a required parameter exists inside an object. If it exists, return the value. If it does not exist, return a default value instead.
Parameters​
Name | Type |
---|---|
name | string |
objWithParam | any |
defaultValue | any |
Returns​
any
Defined in​
getValueFromHotSiteObj​
â–¸ Static
getValueFromHotSiteObj(hotsite
, params
): any
Get a value from a HotSite object.
Parameters​
Name | Type |
---|---|
hotsite | HotSite |
params | string [] |
Returns​
any
Returns the value from the hotsite object. Returns null if it doesn't exist.
Defined in​
onReady​
â–¸ Static
onReady(readyFunc
): void
When the window has finished loading, execute the function. This is meant for web browser use only.
Parameters​
Name | Type |
---|---|
readyFunc | () => void |
Returns​
void
Defined in​
parseBoolean​
â–¸ Static
parseBoolean(value
): boolean
Parse a boolean value.
Parameters​
Name | Type |
---|---|
value | string |
Returns​
boolean
Defined in​
processContent​
â–¸ Static
processContent(processor
, content
, name
, args?
): Promise
<string
>
Process content and get the result.
Parameters​
Name | Type | Default value |
---|---|---|
processor | HotStaq | undefined |
content | string | undefined |
name | string | undefined |
args | any | null |
Returns​
Promise
<string
>
Defined in​
processLocalFile​
â–¸ Static
processLocalFile(localFilepath
, name?
, args?
): Promise
<string
>
Process a local file and get the result.
Parameters​
Name | Type | Default value |
---|---|---|
localFilepath | string | undefined |
name | string | localFilepath |
args | any | null |
Returns​
Promise
<string
>
Defined in​
processUrl​
â–¸ Static
processUrl(options
): Promise
<string
>
Process a url and get the result.
Parameters​
Name | Type |
---|---|
options | HotStartOptions |
Returns​
Promise
<string
>
Defined in​
replaceKey​
â–¸ Static
replaceKey(content
, key
, value
): string
In the supplied content, replace a key in a ${KEY} with a value.
Parameters​
Name | Type |
---|---|
content | string |
key | string |
value | string |
Returns​
string
The content with the correct values.
Defined in​
useOutput​
â–¸ Static
useOutput(output
): void
Replace the current HTML page with the output. This is meant for web browser use only.
Parameters​
Name | Type |
---|---|
output | string |
Returns​
void
Defined in​
wait​
â–¸ Static
wait(numMilliseconds
): Promise
<void
>
Wait for a number of milliseconds.
Parameters​
Name | Type |
---|---|
numMilliseconds | number |
Returns​
Promise
<void
>
Defined in​
waitForTesters​
â–¸ Static
waitForTesters(): Promise
<void
>
Wait for testers to load.
fixme
This does not wait for ALL testers to finish loading. Only
the first one.
Returns​
Promise
<void
>