@abtasty/widget-utils
Advanced tools
Comparing version 1.0.0 to 1.2.0
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var waitForElement=function(e,t,r,n){void 0===t&&(t="");var a=0,l=0;a=setTimeout(function(){var r="[AB Tasty Widget] "+t+" can't find element \""+e+'".';console.debug(r),clearInterval(l)},1e4),l=setInterval(function(){try{null!==document.querySelector(e)&&(clearTimeout(a),clearInterval(l),r(n))}catch(e){clearInterval(l)}},200)};exports.waitForElement=waitForElement; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ready=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,r,n){var o=0,a=0;try{document.querySelector(e)}catch(r){var l="[AB Tasty Widget] "+t+': selector "'+e+'" not valid.';return console.log(l),n(l)}o=setTimeout(function(){clearInterval(a);var r="[AB Tasty Widget] "+t+": can't find element \""+e+'".';return console.log(r),n(r)},1e4),a=setInterval(function(){if(null!==document.querySelector(e))return clearTimeout(o),clearInterval(a),r()},200)};exports.ready=ready,exports.waitForElement=waitForElement; |
@@ -1,1 +0,1 @@ | ||
var waitForElement=function(e,t,n,r){void 0===t&&(t="");var a=0,l=0;a=setTimeout(function(){var n="[AB Tasty Widget] "+t+" can't find element \""+e+'".';console.debug(n),clearInterval(l)},1e4),l=setInterval(function(){try{null!==document.querySelector(e)&&(clearTimeout(a),clearInterval(l),n(r))}catch(e){clearInterval(l)}},200)};export{waitForElement}; | ||
var ready=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,n,r){var o=0,a=0;try{document.querySelector(e)}catch(n){var l="[AB Tasty Widget] "+t+': selector "'+e+'" not valid.';return console.log(l),r(l)}o=setTimeout(function(){clearInterval(a);var n="[AB Tasty Widget] "+t+": can't find element \""+e+'".';return console.log(n),r(n)},1e4),a=setInterval(function(){if(null!==document.querySelector(e))return clearTimeout(o),clearInterval(a),n()},200)};export{ready,waitForElement}; |
{ | ||
"name": "@abtasty/widget-utils", | ||
"version": "1.0.0", | ||
"version": "1.2.0", | ||
"main": "dist/widget-utils.cjs.js", | ||
@@ -11,9 +11,12 @@ "module": "dist/widget-utils.esm.js", | ||
"devDependencies": { | ||
"rollup": "^0.46.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
"jsdom": "^11.2.0", | ||
"mocha": "^3.5.2", | ||
"nyc": "^11.2.1", | ||
"rollup": "^0.49.3", | ||
"rollup-plugin-buble": "^0.15.0", | ||
"rollup-plugin-commonjs": "^8.0.2", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"rollup-plugin-uglify-es": "^0.0.1", | ||
"uglify-es": "^3.0.28" | ||
"uglify-es": "^3.1.0" | ||
}, | ||
@@ -23,5 +26,5 @@ "scripts": { | ||
"dev": "rollup -c -w", | ||
"test": "node test/test.js", | ||
"pretest": "npm run build" | ||
"test": "nyc --reporter=html --reporter=text mocha --require babel-register", | ||
"prepare": "npm run build" | ||
} | ||
} |
# Widgets Utils | ||
<!-- ## Getting started | ||
Collection of useful functions for AB Tasty Widgets. | ||
`npm run build` builds the library to `dist`, generating three files: | ||
## Installation | ||
* `dist/how-long-till-lunch.cjs.js` | ||
A CommonJS bundle, suitable for use in Node.js, that `require`s the external dependency. This corresponds to the `"main"` field in package.json | ||
* `dist/how-long-till-lunch.esm.js` | ||
an ES module bundle, suitable for use in other people's libraries and applications, that `import`s the external dependency. This corresponds to the `"module"` field in package.json | ||
* `dist/how-long-till-lunch.umd.js` | ||
a UMD build, suitable for use in any environment (including the browser, as a `<script>` tag), that includes the external dependency. This corresponds to the `"browser"` field in package.json | ||
Inside your Widget folder, install the `widget-utils` library: | ||
`npm run dev` builds the library, then keeps rebuilding it whenever the source files change using [rollup-watch](https://github.com/rollup/rollup-watch). | ||
```bash | ||
npm install --save-dev @abtasty/widget-utils | ||
``` | ||
`npm test` builds the library, then tests it. --> | ||
_Note: you can also use [yarn](https://yarnpkg.com) instead of npm._ | ||
## Usage | ||
```javascript | ||
import { ready } from '@abtasty/widget-utils' | ||
ready(() => { | ||
// The dom is ready here.. | ||
}) | ||
``` |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
6
24
2340
10