@entur/utils
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [0.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/utils@0.2.9...@entur/utils@0.3.0) (2020-10-09) | ||
### Features | ||
- add useOnMount hook ([0f1fc26](https://bitbucket.org/enturas/design-system/commits/0f1fc2658a1263179be80b656828cf6373834702)) | ||
## [0.2.9](https://bitbucket.org/enturas/design-system/compare/@entur/utils@0.2.8...@entur/utils@0.2.9) (2020-06-17) | ||
@@ -8,0 +14,0 @@ |
export * from './debounce'; | ||
export * from './useRandomId'; | ||
export * from './useOnMount'; | ||
export * from './warnAboutMissingStyles'; |
@@ -29,5 +29,13 @@ 'use strict'; | ||
var packagesToCheck = | ||
/*#__PURE__*/ | ||
new Set(); | ||
function useOnMount(callback) { | ||
var hasRun = React.useRef(false); | ||
React.useEffect(function () { | ||
if (!hasRun.current) { | ||
hasRun.current = true; | ||
callback(); | ||
} | ||
}, [callback]); | ||
} | ||
var packagesToCheck = /*#__PURE__*/new Set(); | ||
var checkTimeoutId; | ||
@@ -69,4 +77,5 @@ | ||
exports.debounce = debounce; | ||
exports.useOnMount = useOnMount; | ||
exports.useRandomId = useRandomId; | ||
exports.warnAboutMissingStyles = warnAboutMissingStyles; | ||
//# sourceMappingURL=utils.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;require("tiny-warning"),exports.debounce=function(e,r){var t;return function(){for(var n=arguments.length,u=new Array(n),o=0;o<n;o++)u[o]=arguments[o];clearTimeout(t),t=setTimeout((function(){return e.apply(void 0,u)}),r)}},exports.useRandomId=function(e){return e+"-"+r.useRef(String(Math.random()).substring(2)).current},exports.warnAboutMissingStyles=function(){}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;require("tiny-warning"),exports.debounce=function(e,t){var r;return function(){for(var n=arguments.length,u=new Array(n),o=0;o<n;o++)u[o]=arguments[o];clearTimeout(r),r=setTimeout((function(){return e.apply(void 0,u)}),t)}},exports.useOnMount=function(e){var r=t.useRef(!1);t.useEffect((function(){r.current||(r.current=!0,e())}),[e])},exports.useRandomId=function(e){return e+"-"+t.useRef(String(Math.random()).substring(2)).current},exports.warnAboutMissingStyles=function(){}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
@@ -23,5 +23,13 @@ import React from 'react'; | ||
var packagesToCheck = | ||
/*#__PURE__*/ | ||
new Set(); | ||
function useOnMount(callback) { | ||
var hasRun = React.useRef(false); | ||
React.useEffect(function () { | ||
if (!hasRun.current) { | ||
hasRun.current = true; | ||
callback(); | ||
} | ||
}, [callback]); | ||
} | ||
var packagesToCheck = /*#__PURE__*/new Set(); | ||
var checkTimeoutId; | ||
@@ -62,3 +70,3 @@ | ||
export { debounce, useRandomId, warnAboutMissingStyles }; | ||
export { debounce, useOnMount, useRandomId, warnAboutMissingStyles }; | ||
//# sourceMappingURL=utils.esm.js.map |
{ | ||
"name": "@entur/utils", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"license": "EUPL-1.2", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "3a208d5a7728adceb92b3f53c460f0a6d8f31051" | ||
"gitHead": "eac1b4d7beec09ac6b5eb132e25dc999b68abe08" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
42205
18
136