HotFile
Class: HotFile
A file to process.
Implements​
IHotFile
Table of contents​
Constructors​
Properties​
Methods​
Constructors​
constructor​
• new HotFile(copy?
)
Parameters​
Name | Type |
---|---|
copy | IHotFile |
Defined in​
Properties​
content​
• content: string
The content of the file to process.
Implementation of​
IHotFile.content
Defined in​
localFile​
• localFile: string
The path to the local file to get.
Implementation of​
IHotFile.localFile
Defined in​
name​
• name: string
The name of the file.
Implementation of​
IHotFile.name
Defined in​
page​
• page: HotPage
The parent page.
Implementation of​
IHotFile.page
Defined in​
throwAllErrors​
• throwAllErrors: boolean
Force all errors to be thrown.
Implementation of​
IHotFile.throwAllErrors
Defined in​
url​
• url: string
The url to the file to get.
Implementation of​
IHotFile.url
Defined in​
Methods​
getContent​
â–¸ getContent(): string
Get the content of this file.
Returns​
string
Defined in​
load​
â–¸ load(): Promise
<string
>
Load the contents of the file.
Returns​
Promise
<string
>
Defined in​
loadLocalFile​
â–¸ loadLocalFile(): Promise
<string
>
Load content from a local file.
Returns​
Promise
<string
>
Defined in​
loadUrl​
â–¸ loadUrl(): Promise
<string
>
Load content from a url.
Returns​
Promise
<string
>
Defined in​
process​
â–¸ process(args?
): Promise
<string
>
Process the content in this file. This treats each file as one large JavaScript file. Any text outside of the <* *> areas will be treated as:
Hot.echo ("text");
fixme
The regex's in the offContent functions need to be fixed. There's several
test cases where they will fail.
Parameters​
Name | Type | Default value |
---|---|---|
args | any | null |
Returns​
Promise
<string
>
Defined in​
setContent​
â–¸ setContent(content
): void
Set the content of this file.
Parameters​
Name | Type |
---|---|
content | string |
Returns​
void
Defined in​
httpGet​
â–¸ Static
httpGet(url
): Promise
<string
>
Make a HTTP get request.
Parameters​
Name | Type |
---|---|
url | string |
Returns​
Promise
<string
>
Defined in​
processContent​
â–¸ Static
processContent(content
, contentRegex
, contentProcessor
, offContentProcessor
, numRemoveFromBeginning?
, numRemoveFromEnd?
): string
Process string content. This will take in a regular expression and parse the content based on the regex. When the regex content is found contentProcessor will be executed with the regex content found. When the regex content is not found, offContentProcessor will be called with the content outside of the regex.
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
content | string | undefined | The content to parse. |
contentRegex | RegExp | undefined | The regex to use to parse the content. |
contentProcessor | (regexFound : string ) => string | undefined | The content found inside the regex. |
offContentProcessor | (offContent : string ) => string | undefined | The content found outside of the regex. |
numRemoveFromBeginning | number | 2 | The number of characters to remove from the beginning of the found content. |
numRemoveFromEnd | number | 2 | The number of characters to remove from the end of the found content. |
Returns​
string
Defined in​
processNestedContent​
â–¸ Static
processNestedContent(content
, startChars
, endChars
, triggerChar
, contentProcessor
, offContentProcessor
, numRemoveFromBeginning?
, numRemoveFromEnd?
): string
Process any content that could have nested values. This will take in a regular expression and parse the content based on the regex. When the regex content is found contentProcessor will be executed with the regex content found. When the regex content is not found, offContentProcessor will be called with the content outside of the regex.
fixme
Needs to be able to ignore any characters found inside comments
or a string. For example, if the following is used ${"Test }"}
It
will error out.
Parameters​
Name | Type | Default value | Description |
---|---|---|---|
content | string | undefined | The content to parse. |
startChars | string | undefined | - |
endChars | string | undefined | - |
triggerChar | string | undefined | - |
contentProcessor | (regexFound : string ) => string | undefined | The content found inside the regex. |
offContentProcessor | (offContent : string ) => string | undefined | The content found outside of the regex. |
numRemoveFromBeginning | number | 2 | The number of characters to remove from the beginning of the found content. |
numRemoveFromEnd | number | 1 | The number of characters to remove from the end of the found content. |
Returns​
string