diff --git a/README.md b/README.md index ecb7472..df0bea1 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,16 @@ export const parameters = { }; ``` +You can override the default timeout value to ensure the DOM is completely loaded before searching for the wrapper selector element. + +```js +export const parameters = { + html: { + delay: 500, // default: 0 + }, +}; +``` + When using Web Components, the HTML will contain empty comments, i.e. ``. If you want to remove these, use the `removeEmptyComments` parameter: diff --git a/addon/src/decorators/withHTML.js b/addon/src/decorators/withHTML.js index fedf8bc..d92f4dc 100644 --- a/addon/src/decorators/withHTML.js +++ b/addon/src/decorators/withHTML.js @@ -15,7 +15,7 @@ export const withHTML = makeDecorator({ html = html.replace(//g, ''); } channel.emit(EVENT_CODE_RECEIVED, { html, options: parameters }); - }, 0); + }, parameters.delay || 0); return storyFn(context); }, });