Skip to content

Commit

Permalink
fix prevent-fetch docs
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 9812373
Author: Slava Leleka <[email protected]>
Date:   Wed Apr 27 19:28:39 2022 +0300

    fix prevent-fetch docs
  • Loading branch information
slavaleleka committed Apr 27, 2022
1 parent 0c470bd commit 2a72d26
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions src/scriptlets/prevent-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,34 @@ import {
* which is useful for debugging but permitted for production filter lists.
*
* **Examples**
* 1. Prevent all fetch calls
* 1. Log all fetch calls
* ```
* example.org#%#//scriptlet('prevent-fetch')
* OR
* ```
*
* 2. Prevent all fetch calls
* ```
* example.org#%#//scriptlet('prevent-fetch', '*')
* OR
* example.org#%#//scriptlet('prevent-fetch', '')
* ```
*
* 2. Prevent fetch call for specific url
* 3. Prevent fetch call for specific url
* ```
* example.org#%#//scriptlet('prevent-fetch', '/url\\.part/')
* ```
*
* 3. Prevent fetch call for specific request method
* 4. Prevent fetch call for specific request method
* ```
* example.org#%#//scriptlet('prevent-fetch', 'method:HEAD')
* ```
*
* 4. Prevent fetch call for specific url and request method
* 5. Prevent fetch call for specific url and request method
* ```
* example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/')
* ```
*
* 5. Prevent fetch call and specify response body value
* 6. Prevent fetch call and specify response body value
* ```
* ! Specify response body for fetch call to a specific url
* example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/', 'emptyArr')
Expand Down
15 changes: 9 additions & 6 deletions wiki/about-scriptlets.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,31 +759,34 @@ example.org#%#//scriptlet('prevent-fetch'[, propsToMatch[, responseBody]])
which is useful for debugging but permitted for production filter lists.

**Examples**
1. Prevent all fetch calls
1. Log all fetch calls
```
example.org#%#//scriptlet('prevent-fetch')
OR
```

2. Prevent all fetch calls
```
example.org#%#//scriptlet('prevent-fetch', '*')
OR
example.org#%#//scriptlet('prevent-fetch', '')
```

2. Prevent fetch call for specific url
3. Prevent fetch call for specific url
```
example.org#%#//scriptlet('prevent-fetch', '/url\\.part/')
```

3. Prevent fetch call for specific request method
4. Prevent fetch call for specific request method
```
example.org#%#//scriptlet('prevent-fetch', 'method:HEAD')
```

4. Prevent fetch call for specific url and request method
5. Prevent fetch call for specific url and request method
```
example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/')
```

5. Prevent fetch call and specify response body value
6. Prevent fetch call and specify response body value
```
! Specify response body for fetch call to a specific url
example.org#%#//scriptlet('prevent-fetch', '/specified_url_part/ method:/HEAD|GET/', 'emptyArr')
Expand Down

0 comments on commit 2a72d26

Please sign in to comment.