uhooks-dom
Advanced tools
Comparing version 0.1.10 to 0.2.0
@@ -34,4 +34,4 @@ 'use strict'; | ||
const hook = $hooked(fn, outer); | ||
return function () { | ||
const node = hook.apply(this, arguments); | ||
return /*async*/ function () { | ||
const node = /*await*/ hook.apply(this, arguments); | ||
if (hasEffect(hook)) { | ||
@@ -38,0 +38,0 @@ const element = get(node); |
@@ -33,4 +33,4 @@ /*! (c) Andrea Giammarchi - ISC */ | ||
const hook = $hooked(fn, outer); | ||
return function () { | ||
const node = hook.apply(this, arguments); | ||
return /*async*/ function () { | ||
const node = /*await*/ hook.apply(this, arguments); | ||
if (hasEffect(hook)) { | ||
@@ -37,0 +37,0 @@ const element = get(node); |
40
index.js
@@ -363,3 +363,5 @@ self.uhooksDOM = (function (exports) { | ||
var hooked$1 = function hooked$1(callback, outer) { | ||
return hooked(outer ? function hook() { | ||
return hooked(outer ? | ||
/*async*/ | ||
function hook() { | ||
var ph = h$1, | ||
@@ -373,3 +375,6 @@ pc = c, | ||
try { | ||
return callback.apply(c, a); | ||
return ( | ||
/*await*/ | ||
callback.apply(c, a) | ||
); | ||
} finally { | ||
@@ -409,17 +414,22 @@ h$1 = ph; | ||
var hook = hooked$1(fn, outer); | ||
return function () { | ||
var node = hook.apply(this, arguments); | ||
return ( | ||
/*async*/ | ||
function () { | ||
var node = | ||
/*await*/ | ||
hook.apply(this, arguments); | ||
if (hasEffect(hook)) { | ||
var element = get(node); | ||
if (!observer) observer = observe(element.ownerDocument, 'children', CustomEvent$1); | ||
if (!observer.has(element)) observer.connect(element, { | ||
disconnected: function disconnected() { | ||
dropEffect(hook); | ||
} | ||
}); | ||
if (hasEffect(hook)) { | ||
var element = get(node); | ||
if (!observer) observer = observe(element.ownerDocument, 'children', CustomEvent$1); | ||
if (!observer.has(element)) observer.connect(element, { | ||
disconnected: function disconnected() { | ||
dropEffect(hook); | ||
} | ||
}); | ||
} | ||
return node; | ||
} | ||
return node; | ||
}; | ||
); | ||
}; | ||
@@ -426,0 +436,0 @@ |
{ | ||
"name": "uhooks-dom", | ||
"version": "0.1.10", | ||
"version": "0.2.0", | ||
"description": "A uhooks + uconnect based alternative to dom-augmentor", | ||
"main": "./cjs/index.js", | ||
"scripts": { | ||
"build": "npm run cjs && npm run rollup:es && npm run rollup:babel && npm run min && npm run size", | ||
"build": "npm run async && npm run cjs && npm run rollup:async && npm run rollup:es && npm run rollup:babel && npm run min && npm run size", | ||
"cjs": "ascjs --no-default esm cjs", | ||
"async": "cp esm/index.js esm/async.js && sed -i.bck 's/uhooks-fx/uhooks-fx\\/async/; s/\\/\\*async\\*\\//async/; s/\\/\\*await\\*\\//await/' esm/async.js && rm -rf esm/async.js.bck", | ||
"rollup:async": "rollup --config rollup/async.config.js && sed -i.bck 's/^var /self./; s/Object.defineProperty[^)]*).//' async.js && rm -rf async.js.bck", | ||
"rollup:es": "rollup --config rollup/es.config.js && sed -i.bck 's/^var /self./; s/Object.defineProperty[^)]*).//' es.js && rm -rf es.js.bck", | ||
"rollup:babel": "rollup --config rollup/babel.config.js && sed -i.bck 's/^var /self./; s/Object.define[^;]*;//' index.js && rm -rf index.js.bck", | ||
"min": "terser index.js --comments='/^!/' -c -m -o min.js", | ||
"size": "cat min.js | brotli | wc -c && cat es.js | brotli | wc -c" | ||
"size": "echo 'async ES6' && cat async.js | brotli | wc -c && echo '' && echo 'sync ES5 / ES6' && cat min.js | brotli | wc -c && cat es.js | brotli | wc -c" | ||
}, | ||
@@ -40,2 +42,6 @@ "keywords": [ | ||
}, | ||
"./async": { | ||
"import": "./esm/async.js", | ||
"default": "./cjs/async.js" | ||
}, | ||
"./package.json": "./package.json" | ||
@@ -47,3 +53,3 @@ }, | ||
"uconnect": "^0.2.7", | ||
"uhooks-fx": "^0.1.7" | ||
"uhooks-fx": "^0.2.0" | ||
}, | ||
@@ -50,0 +56,0 @@ "repository": { |
# <em>µ</em>hooks-dom | ||
A [µhooks](https://github.com/WebReflection/uhooks#readme) + [µconnect](https://github.com/WebReflection/uconnect#readme) based alternative to [dom-augmentor](https://github.com/WebReflection/dom-augmentor). | ||
This module exports same utilities via `uhooks-dom/async`, which is based on `uhooks-fx/async` for asynchronous hooks. |
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
31774
13
640
6
+ Addeduhooks@0.2.8(transitive)
+ Addeduhooks-fx@0.2.4(transitive)
- Removeduhooks@0.1.19(transitive)
- Removeduhooks-fx@0.1.7(transitive)
Updateduhooks-fx@^0.2.0