Skip to content

Commit 17ffe55

Browse files
committed
feat(Storybook): add polyfill and babel-polyfill to support IE/Edge
1 parent 5003921 commit 17ffe55

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ Single React component or element that is used as the target (observable).
171171

172172
### Notes
173173

174-
* According to the spec, a first callback invocation occurs when the target is first attached to the observer.
174+
* According to the spec, an initial event is being fired when starting to observe a non-intersecting element as well.
175+
* _Edge's implementation seems to [miss the initial event](https://github.com/w3c/IntersectionObserver/issues/222#issuecomment-311539591), although Edge 16 behavior aligns with the spec._
175176
* Changes happen asynchronously, similar to the way `requestIdleCallback` works.
176177
* Although you can consider callbacks immediate - always below 1 second - you can also get an immediate response on an element's visibility with `observer.takeRecords()`.
178+
* Support for _Map_, _Symbol_ and other native features and primitives is required. Consider using a polyfill for IE < 11 and older browsers. If you're using babel include `"babel-polyfill"` somewhere to your codebase.
177179

178180
## Polyfill
179181

docs/docs/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'babel-polyfill';
2+
import 'intersection-observer';
13
import { storiesOf } from '@storybook/react';
24
import WindowRoot from './components/WindowRoot';
35
import WindowFrame from './components/WindowFrame';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"babel-cli": "^6.24.1",
2020
"babel-eslint": "^8.0.0",
2121
"babel-jest": "^21.0.0",
22+
"babel-polyfill": "^6.26.0",
2223
"conventional-github-releaser": "^1.1.12",
2324
"cross-env": "^5.0.5",
2425
"css-loader": "^0.28.4",

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5840,9 +5840,9 @@ range-parser@^1.0.3, range-parser@~1.2.0:
58405840
version "1.2.0"
58415841
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
58425842

5843-
raw-loader@^0.5.1:
5844-
version "0.5.1"
5845-
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
5843+
raw-loader@^1.0.0-beta.0:
5844+
version "1.0.0-beta.0"
5845+
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-1.0.0-beta.0.tgz#617853ce8314d1166c06758d9302d24faf08d44c"
58465846

58475847
rc@^1.1.7:
58485848
version "1.2.1"
@@ -6751,9 +6751,9 @@ style-loader@^0.17.0:
67516751
dependencies:
67526752
loader-utils "^1.0.2"
67536753

6754-
style-loader@^0.18.2:
6755-
version "0.18.2"
6756-
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.18.2.tgz#cc31459afbcd6d80b7220ee54b291a9fd66ff5eb"
6754+
style-loader@^0.19.0:
6755+
version "0.19.0"
6756+
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.19.0.tgz#7258e788f0fee6a42d710eaf7d6c2412a4c50759"
67576757
dependencies:
67586758
loader-utils "^1.0.2"
67596759
schema-utils "^0.3.0"

0 commit comments

Comments
 (0)