Constructor
new SafetyCheck(service)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
service |
LinkService | The service this SafetyCheck is registered to. |
Methods
check(urls) → {Promise|undefined}
- Source:
Check to see if the provided URLs should be considered safe or not. This method may return a Promise, but is not required to.
Rather than returning a value, this method should modify the
CheckedURLs by setting unsafe
to true if necessary and by
adding strings to flags.
Parameters:
Name | Type | Description |
---|---|---|
urls |
Object.<string, CheckedURL> | The URLs to check. |
Returns:
If a Promise is returned, the LinkService will wait until the Promise resolves to consider the URLs checked.
- Type
- Promise | undefined
getExamples() → {Array.<ExampleURL>|Array.<String>|Array.<URL>}
- Source:
Get an array of example URLs that this SafetyCheck can handle. Used for populating a selection field in testing clients.
The default implementation checks if the SafetyCheck class has
a static array called examples
and, if so, returns that.
It is not necessary to provide examples, but examples do make testing easier.
Example
class MyCheck extends SafetyCheck { };
MyCheck.examples = [
{title: 'Some Page', url: 'https://example.com/'}
];
Returns:
List of URLs.
- Type
- Array.<ExampleURL> | Array.<String> | Array.<URL>