You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -172,6 +183,14 @@ The Subscribe component provides the UI to subscribe to notifications and/or ema
172
183
173
184
This component embeds the [Button Swap component](/?path=/docs/components-button-swap--default-story) for the "Get Notifications" button.
174
185
186
+
## Destroy/Initialize
187
+
188
+
The Subscribe component allows you to programmatically disable/enable the JavaScript functionality via its `destroy()` and `init()` methods. When "destroyed," the following will occur:
189
+
190
+
- The "Get notifications"/"Get Weekly Digests" UI will be removed
191
+
- The weekly digests form will be shown
192
+
- All Subscribe component JavaScript will be removed
193
+
175
194
<Canvas>
176
195
<Story
177
196
name="Default"
@@ -213,7 +232,7 @@ The Subscribe component UX can be progressively enhanced using JavaScript. Enhan
213
232
### Syntax
214
233
215
234
```js
216
-
initSubscribe(subscribeEl);
235
+
constsubscribe=createSubscribe(subscribeEl);
217
236
```
218
237
219
238
### Parameters
@@ -224,42 +243,55 @@ The Subscribe component `.js-subscribe` root element.
224
243
225
244
### Return value
226
245
227
-
An object with a `destroy` function that removes all event listeners added by this component.
246
+
An object with two functions to programmatically control the Subscribe component's
|`subscribe.init()`| Initializes the Subscribe component to its default UI state, including all JavaScript functionality. |
259
+
|`subscribe.destroy()`| Removes the "Get notifications"/"Get Weekly Digests" CTA UI leaving only the weekly digests sign up form. All JavaScript functionality is disabled. |
0 commit comments