use-aspect-ratio
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.UseAspectRatio=t(require("react")):e.UseAspectRatio=t(e.React)}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);function o(){return{innerHeight:window.innerHeight,innerWidth:window.innerWidth,outerHeight:window.outerHeight,outerWidth:window.outerWidth}}function u(e){var t=r.useState(o()),n=t[0],u=t[1],i=function(){window.requestAnimationFrame(function(){var t=o();e(t),u(t)})};return r.useEffect(function(){return e(n),window.addEventListener("resize",i,!1),function(){return window.removeEventListener("resize",i,!1)}},[]),n}t.useWindowSize=u,t.useAspectRatio=function(e){var t=r.useRef(null),n=r.useState(600),o=n[0],i=n[1];return u(function(){return t.current&&i(t.current.clientWidth)}),r.useEffect(function(){t.current&&(t.current.style.height=Math.round(o/e)+"px")},[o]),t}},function(t,n){t.exports=e}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.UseAspectRatio=t(require("react")):e.UseAspectRatio=t(e.React)}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);function o(){return{innerHeight:window.innerHeight,innerWidth:window.innerWidth,outerHeight:window.outerHeight,outerWidth:window.outerWidth}}function u(e){var t=r.useState(o()),n=t[0],u=t[1],i=function(){window.requestAnimationFrame(function(){var t=o();e(t),u(t)})};return r.useLayoutEffect(function(){return e(n),window.addEventListener("resize",i,!1),function(){return window.removeEventListener("resize",i,!1)}},[]),n}t.useWindowSize=u,t.useAspectRatio=function(e){var t=r.useRef(null),n=r.useState(600),o=n[0],i=n[1];return u(function(){return t.current&&i(t.current.clientWidth)}),r.useLayoutEffect(function(){t.current&&(t.current.style.height=Math.round(o/e)+"px")},[o]),t}},function(t,n){t.exports=e}])}); |
@@ -32,31 +32,31 @@ { | ||
"devDependencies": { | ||
"@types/jasmine": "^2.5.53", | ||
"@types/react": "^16.8.10", | ||
"@types/react-dom": "^16.8.3", | ||
"@types/webpack": "^4.4.26", | ||
"awesome-typescript-loader": "^5.2.0", | ||
"cross-env": "^5.0.1", | ||
"ejs-loader": "^0.3.0", | ||
"eslint": "^5.4.0", | ||
"@types/jasmine": "^3.3.13", | ||
"@types/react": "^16.8.23", | ||
"@types/react-dom": "^16.8.4", | ||
"@types/webpack": "^4.4.35", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"cross-env": "^5.2.0", | ||
"ejs-loader": "^0.3.3", | ||
"eslint": "^6.0.1", | ||
"html-webpack-plugin": "^3.2.0", | ||
"istanbul-instrumenter-loader": "^3.0.0", | ||
"jasmine": "^3.2.0", | ||
"jasmine-core": "^3.2.1", | ||
"karma": "^3.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage-istanbul-reporter": "^2.0.1", | ||
"karma-jasmine": "^1.1.0", | ||
"istanbul-instrumenter-loader": "^3.0.1", | ||
"jasmine": "^3.4.0", | ||
"jasmine-core": "^3.4.0", | ||
"karma": "^4.2.0", | ||
"karma-chrome-launcher": "^3.0.0", | ||
"karma-coverage-istanbul-reporter": "^2.0.5", | ||
"karma-jasmine": "^2.0.1", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-spec-reporter": "0.0.32", | ||
"karma-webpack": "^3.0.0", | ||
"rimraf": "^2.6.1", | ||
"source-map-loader": "^0.2.1", | ||
"style-loader": "^0.22.1", | ||
"tslint": "^5.5.0", | ||
"karma-webpack": "^4.0.2", | ||
"rimraf": "^2.6.3", | ||
"source-map-loader": "^0.2.4", | ||
"style-loader": "^0.23.1", | ||
"tslint": "^5.18.0", | ||
"tslint-config-airbnb": "^5.11.1", | ||
"tslint-loader": "^3.5.3", | ||
"typescript": "^3.0.1", | ||
"webpack": "^4.17.0", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-dev-server": "^3.1.5" | ||
"tslint-loader": "^3.5.4", | ||
"typescript": "^3.5.3", | ||
"webpack": "^4.36.1", | ||
"webpack-cli": "^3.3.6", | ||
"webpack-dev-server": "^3.7.2" | ||
}, | ||
@@ -80,3 +80,3 @@ "directories": { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"peerDependencies": { | ||
@@ -83,0 +83,0 @@ "react": ">=16.8.0", |
@@ -1,2 +0,2 @@ | ||
import { useState, useEffect, useRef } from 'react'; | ||
import { useState, useLayoutEffect, useRef } from 'react'; | ||
@@ -36,3 +36,3 @@ type WindowSize = { | ||
useEffect( | ||
useLayoutEffect( | ||
() => { | ||
@@ -56,3 +56,3 @@ callback(windowSize); | ||
useEffect( | ||
useLayoutEffect( | ||
() => { | ||
@@ -59,0 +59,0 @@ if (ref.current) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21810