@unhead/vue 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -99,9 +99,9 @@ function useScript(_input, _options) {
|
|
|
99
99
|
const head = injectHead.injectHead();
|
|
100
100
|
const options = _options || {};
|
|
101
101
|
options.head = head;
|
|
102
|
-
options.eventContext = vue.getCurrentInstance();
|
|
103
102
|
const scope = vue.getCurrentInstance();
|
|
104
|
-
|
|
103
|
+
options.eventContext = scope;
|
|
104
|
+
if (scope && typeof options.trigger === "undefined")
|
|
105
105
|
options.trigger = vue.onMounted;
|
|
106
106
|
const key = unhead.resolveScriptKey(input);
|
|
107
107
|
if (head._scripts?.[key])
|
|
@@ -134,6 +134,9 @@ function useScript(_input, _options) {
|
|
|
134
134
|
vue.onScopeDispose(destroy);
|
|
135
135
|
return destroy;
|
|
136
136
|
};
|
|
137
|
+
vue.onScopeDispose(() => {
|
|
138
|
+
script._triggerAbortController?.abort();
|
|
139
|
+
});
|
|
137
140
|
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
|
138
141
|
script.onError = (cb) => _registerCb("error", cb);
|
|
139
142
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -99,9 +99,9 @@ function useScript(_input, _options) {
|
|
|
99
99
|
const head = injectHead();
|
|
100
100
|
const options = _options || {};
|
|
101
101
|
options.head = head;
|
|
102
|
-
options.eventContext = getCurrentInstance();
|
|
103
102
|
const scope = getCurrentInstance();
|
|
104
|
-
|
|
103
|
+
options.eventContext = scope;
|
|
104
|
+
if (scope && typeof options.trigger === "undefined")
|
|
105
105
|
options.trigger = onMounted;
|
|
106
106
|
const key = resolveScriptKey(input);
|
|
107
107
|
if (head._scripts?.[key])
|
|
@@ -134,6 +134,9 @@ function useScript(_input, _options) {
|
|
|
134
134
|
onScopeDispose(destroy);
|
|
135
135
|
return destroy;
|
|
136
136
|
};
|
|
137
|
+
onScopeDispose(() => {
|
|
138
|
+
script._triggerAbortController?.abort();
|
|
139
|
+
});
|
|
137
140
|
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
|
138
141
|
script.onError = (cb) => _registerCb("error", cb);
|
|
139
142
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.1",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"hookable": "^5.5.3",
|
|
69
|
-
"unhead": "1.10.
|
|
70
|
-
"@unhead/
|
|
71
|
-
"
|
|
69
|
+
"@unhead/schema": "1.10.1",
|
|
70
|
+
"@unhead/shared": "1.10.1",
|
|
71
|
+
"unhead": "1.10.1"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "unbuild .",
|