Skip to content

Commit 7c5c2fb

Browse files
committed
README: add blockList option
1 parent ad70ebd commit 7c5c2fb

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Or manually:
3939
```html
4040
<script
4141
type="text/javascript"
42-
src="https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js">
43-
</script>
42+
src="https://cdn.jsdelivr.net/npm/@emailjs/browser@4/dist/email.min.js"
43+
></script>
4444
<script type="text/javascript">
4545
(function () {
4646
emailjs.init({
@@ -115,10 +115,20 @@ Options can be declared globally using the **init** method or locally as the fou
115115
\
116116
The local parameter will have higher priority than the global one.
117117

118-
| Name | Type | Default | Description |
119-
| ------------- | ------- | ------- | -------------------------------------------------------- |
120-
| publicKey | String | | The public key is required to invoke the method. |
121-
| blockHeadless | Boolean | False | Method will return error 451 if the browser is headless. |
118+
| Name | Type | Default | Description |
119+
| ------------- | --------- | ------- | -------------------------------------------------------- |
120+
| publicKey | String | | The public key is required to invoke the method. |
121+
| blockHeadless | Boolean | False | Method will return error 451 if the browser is headless. |
122+
| blockList | BlockList | | Block list settings. |
123+
124+
**BlockList**
125+
126+
Allows to ignore a method call if the watched variable contains a value from the block list.
127+
128+
| Name | Type | Description |
129+
| ------------- | -------- | -------------------------------------------------- |
130+
| list | String[] | The array of strings contains values for blocking. |
131+
| watchVariable | String | A name of the variable to be watched. |
122132

123133
**Declare global settings**
124134

@@ -128,6 +138,9 @@ import emailjs from '@emailjs/browser';
128138
emailjs.init({
129139
publicKey: 'YOUR_PUBLIC_KEY',
130140
blockHeadless: true,
141+
blockList: {
142+
list: ['foo@emailjs.com', 'bar@emailjs.com'],
143+
},
131144
});
132145
```
133146

@@ -144,6 +157,9 @@ const templateParams = {
144157
emailjs
145158
.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', templateParams, {
146159
publicKey: 'YOUR_PUBLIC_KEY',
160+
blockList: {
161+
watchVariable: 'userEmail',
162+
},
147163
})
148164
.then(
149165
(response) => {

0 commit comments

Comments
 (0)