1 | import {
|
2 | default as doUpdate,
|
3 | getInjectedMetaTags
|
4 | } from '../React/client-update-page-info';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | const clientUpdatePageinfo = (info = {}) => {
|
16 | if (!__CLIENT__) return;
|
17 | let { title, metas } = info;
|
18 |
|
19 | if (typeof title === 'undefined') title = document.title;
|
20 | if (typeof metas === 'undefined') {
|
21 | metas = [...getInjectedMetaTags()].map(el =>
|
22 | Object.fromEntries(
|
23 | el
|
24 | .getAttributeNames()
|
25 | .map(attr => [attr, el.getAttribute(attr)])
|
26 | )
|
27 | );
|
28 | }
|
29 |
|
30 | return doUpdate(title, metas);
|
31 | };
|
32 |
|
33 | export default clientUpdatePageinfo;
|