{"_id":"@1productaweek/react-wait-for-window","_rev":"1-4a5cd59c6ee3adea43cdc645a4e75547","name":"@1productaweek/react-wait-for-window","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@1productaweek/react-wait-for-window","version":"0.1.0","description":"Wait for a window prop to become ready (e.g. when loading scriprs async)","main":"dist/index.js","scripts":{"clean":"rimraf dist","build":"yarn clean &&  NODE_ENV=production  babel src --ignore .spec.js,__mocks__ -d dist --copy-files --extensions '.ts,.tsx,.js' && rimraf -rf dist/**/__tests__ && yarn build:types","build:types":"tsc -p tsconfig.types.json","install:peers":"install-peers -f","prepare":"npm run clean && npm run build && yarn install:peers","release":"yarn publish --access=public","test":"jest"},"author":{"name":"Calum Moore"},"license":"MIT","homepage":"https://github.com/1productaweek/react-wait-for-window","devDependencies":{"@babel/cli":"^7.10.4","@babel/core":"^7.10.4","@babel/plugin-proposal-optional-chaining":"^7.10.4","@babel/plugin-transform-react-display-name":"^7.10.4","@babel/plugin-transform-runtime":"^7.10.4","@babel/preset-env":"^7.10.4","@babel/preset-react":"^7.10.4","@babel/preset-typescript":"^7.10.4","@storybook/addon-knobs":"^5.3.19","@testing-library/jest-dom":"^5.11.0","@testing-library/react":"^10.4.5","@testing-library/react-hooks":"^3.3.0","@types/jest":"^26.0.4","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","babel-eslint":"^10.1.0","babel-jest":"^26.1.0","babel-loader":"^8.1.0","babel-plugin-add-module-exports":"^1.0.2","babel-plugin-inline-import":"^3.0.0","babel-plugin-module-resolver":"^4.0.0","babel-plugin-source-map-support":"^2.1.2","babel-plugin-transform-class-properties":"^6.24.1","babel-plugin-transform-export-extensions":"^6.22.0","babel-plugin-transform-object-assign":"^6.22.0","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^7.0.0-beta.3","babel-preset-react-app":"^9.1.2","babel-register":"^7.0.0-beta.3","eslint":"^7.4.0","eslint-config-react-app":"^5.2.1","eslint-config-standard":"^14.1.1","eslint-config-standard-react":"^9.2.0","eslint-import-resolver-babel-module":"^5.1.0","eslint-import-resolver-node":"^0.3.4","eslint-import-resolver-typescript":"^2.0.0","eslint-loader":"^4.0.2","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-react":"^7.20.3","eslint-plugin-react-hooks":"^4.0.7","eslint-plugin-standard":"^4.0.1","install-peers-cli":"^2.2.0","jest":"^26.1.0","jest-environment-jsdom-fourteen":"^1.0.1","npm-run-all":"^4.1.5","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","typescript":"^3.9.6","uglifyjs-webpack-plugin":"^2.2.0","watch":"^1.0.2"},"dependencies":{},"peerDependencies":{"react":"^16.13.1"},"jest":{"roots":["<rootDir>/src"],"testMatch":["<rootDir>/src/**/__tests__/**/*.spec.{js,jsx,ts,tsx}","<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"],"testEnvironment":"jest-environment-jsdom-fourteen"},"licenseText":"Copyright 2020 1 Product a Week\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"@1productaweek/react-wait-for-window@0.1.0","dist":{"shasum":"035f5d5185946f779c23226bdf4829b0580ba1b6","integrity":"sha512-o8eh3QqVil1dXgK9chjzZsstaiG2aedgOd6dQVzu59BDc403K58WW8XEvcKR0ElZ0cwiVMH+oi8qM1scYtrjpA==","tarball":"https://registry.npmjs.org/@1productaweek/react-wait-for-window/-/react-wait-for-window-0.1.0.tgz","fileCount":13,"unpackedSize":8710,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfDdezCRA9TVsSAnZWagAA8vkQAKBMd4TNY96yvEkdSgFh\nZHpFmr50vVU2PmNrvT4w86TN9m10K512NutGd0v/uRateB93RwEAhEVkB4gs\nAuBFcfTe07hDrdkf5PFrtamBOWqpx81/DIb727zCgpA2Pjcgxq5657DYaicl\n/CcJF5ujIfacBN5E1fNrMLfxC7dGGC9h3UoZCdrh5CBfZGTJJIhfoVJZrz3V\nS3GMkh94DQWPEYm4x/hbYPqdG0zBRy29NhFEGyVdRO4OGXeht+yh7uVx4cXR\nYlpmHGG1Nxrii7Rbw1P5EGWpnQeO1GVYozcEjE9uloNzALl6wk5XzJJEm0km\nouiqbwOt6rSzVrXmyqQkLDZpOio0Vi82u0J/94llGRSTcwNpkrLr1wZae3dO\nZrxfqsPfq9QXQbj/1BqnT9MfOQE1B30Gxz+RdVqJx7ne8gccCkQuYIKCik6Z\nFFWBDjhxjlXTxS/M5m5tdLrTOQysRjDlQNUZg4nnbszaSIBuo0SKkHv3ZeCr\n0Qx76eNE7KCM3Xsa9XMyGFPUfwbXUMqqNwmFD3ZZZaqBRHVtAmOZvfPQP0bD\nrISoxcsNB4x4dmpLZd4do79E+5NUaJ6DXwFm4JkdNX7uDLPdfv1dzREKVvy4\nGIT9xX20XQNx6c5HBsOwGKPI6mKdL4UNkigfqpnrov0LPiPhRQBjR3WfeVdj\nLm4c\r\n=218k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDVFMKgeyJEH4Umalp/6LFK3Mow4dWVdFP3IL9TdRmukAiAxqJfSfhQxJ2KaU57fg6jV+6r1QvBrtjdegr7DmQC/UQ=="}]},"maintainers":[{"name":"calum.moore","email":"calum.moore@gmail.com"}],"_npmUser":{"name":"calum.moore","email":"calum.moore@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-wait-for-window_0.1.0_1594742706685_0.09216167878481096"},"_hasShrinkwrap":false}},"time":{"created":"2020-07-14T16:05:06.443Z","0.1.0":"2020-07-14T16:05:06.786Z","modified":"2022-04-04T10:34:20.889Z"},"maintainers":[{"name":"calum.moore","email":"calum.moore@gmail.com"}],"description":"Wait for a window prop to become ready (e.g. when loading scriprs async)","homepage":"https://github.com/1productaweek/react-wait-for-window","author":{"name":"Calum Moore"},"license":"MIT","readme":"# React Wait for Window\n\nWaits for a window prop to become available. E.g. if you're loading Stripe async, you will need to wait for it to become available before trying to use any components that rely on it.\n\n```\nnpm install @1producataweek/react-wait-for-window\n```\n\n\n### useWaitForWindow(prop: string, timer: number): boolean\n\nA hook that will update when the window prop becomes available. Returns true/false depending on whether the prop is set on `window`. The timer is the interval that the prop should be checked.\n\n```tsx\nimport { useWaitForWindow } from '@1producataweek/react-wait-for-window'\n\nfunction Component () {\n  const propIsAvailable = useWaitForWindow('stripe', 1000)\n\n  if (!propIsAvailable) return 'Loading'\n\n  return <ComponentThatDependsOnWindowProp />\n}\n```\n\n\n### WaitForWindow\n\nA hook that will update when the window prop becomes available. Returns true/false depending on whether the prop is set on `window`. The timer will set \n\n```tsx\nimport { WaitForWindow } from '@1producataweek/react-wait-for-window'\n\nfunction Component () {\n  return (\n    <WaitForWindow prop='' timer={1000}>\n      <ComponentThatDependsOnWindowProp />\n    </WaitForWindow>\n  )\n}\n```\n\n\n\n### Made by 1PAW\n\nhttps://1productaweek.com\n  |\n  |- [Ralley](https://ralley.io) - queue as a service\n  |- [Snapboard](https://snapboard.io) - simple hackable dashboard","readmeFilename":"README.md"}