@unhead/vue 1.8.0-beta.7 → 1.8.0-beta.9
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 +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -104,10 +104,7 @@ function useScript(_input, _options) {
|
|
|
104
104
|
shared.NetworkEvents.forEach((fn) => {
|
|
105
105
|
const _fn = typeof input[fn] === "function" ? input[fn].bind(ctx) : null;
|
|
106
106
|
if (_fn) {
|
|
107
|
-
input[fn] = (e) =>
|
|
108
|
-
status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
|
|
109
|
-
_fn && _fn(e);
|
|
110
|
-
};
|
|
107
|
+
input[fn] = (e) => _fn(e);
|
|
111
108
|
}
|
|
112
109
|
});
|
|
113
110
|
options.stub = ({ script, fn }) => {
|
|
@@ -119,7 +116,16 @@ function useScript(_input, _options) {
|
|
|
119
116
|
};
|
|
120
117
|
}
|
|
121
118
|
};
|
|
122
|
-
|
|
119
|
+
const instance = unhead.useScript(input, options);
|
|
120
|
+
function syncStatus({ script }) {
|
|
121
|
+
if (script.id === instance.$script.id) {
|
|
122
|
+
status.value = script.status;
|
|
123
|
+
if (script.status === "removed")
|
|
124
|
+
head.hooks.removeHook(`script:updated`, syncStatus);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
head.hooks.hook(`script:updated`, syncStatus);
|
|
128
|
+
return instance;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
exports.CapoPlugin = unhead.CapoPlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -104,10 +104,7 @@ function useScript(_input, _options) {
|
|
|
104
104
|
NetworkEvents.forEach((fn) => {
|
|
105
105
|
const _fn = typeof input[fn] === "function" ? input[fn].bind(ctx) : null;
|
|
106
106
|
if (_fn) {
|
|
107
|
-
input[fn] = (e) =>
|
|
108
|
-
status.value = fn === "onload" ? "loaded" : fn === "onerror" ? "error" : "loading";
|
|
109
|
-
_fn && _fn(e);
|
|
110
|
-
};
|
|
107
|
+
input[fn] = (e) => _fn(e);
|
|
111
108
|
}
|
|
112
109
|
});
|
|
113
110
|
options.stub = ({ script, fn }) => {
|
|
@@ -119,7 +116,16 @@ function useScript(_input, _options) {
|
|
|
119
116
|
};
|
|
120
117
|
}
|
|
121
118
|
};
|
|
122
|
-
|
|
119
|
+
const instance = useScript$1(input, options);
|
|
120
|
+
function syncStatus({ script }) {
|
|
121
|
+
if (script.id === instance.$script.id) {
|
|
122
|
+
status.value = script.status;
|
|
123
|
+
if (script.status === "removed")
|
|
124
|
+
head.hooks.removeHook(`script:updated`, syncStatus);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
head.hooks.hook(`script:updated`, syncStatus);
|
|
128
|
+
return instance;
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
export { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.8.0-beta.
|
|
4
|
+
"version": "1.8.0-beta.9",
|
|
5
5
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"hookable": "^5.5.3",
|
|
51
|
-
"@unhead/schema": "1.8.0-beta.
|
|
52
|
-
"@unhead/shared": "1.8.0-beta.
|
|
53
|
-
"unhead": "1.8.0-beta.
|
|
51
|
+
"@unhead/schema": "1.8.0-beta.9",
|
|
52
|
+
"@unhead/shared": "1.8.0-beta.9",
|
|
53
|
+
"unhead": "1.8.0-beta.9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"vue": "^3.3.4"
|