corvée(dépendances) ajoute Carbon Fields
This commit is contained in:
parent
135cc65eed
commit
62368587e5
459 changed files with 72750 additions and 26 deletions
28
web/vendor/htmlburger/carbon-fields/packages/metaboxes/containers/root-registry.js
vendored
Normal file
28
web/vendor/htmlburger/carbon-fields/packages/metaboxes/containers/root-registry.js
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const rootRegistry = {};
|
||||
|
||||
export function registerContainerRoot( containerId, root ) {
|
||||
rootRegistry[ containerId ] = {
|
||||
createdAt: Math.floor(Date.now() / 1000),
|
||||
...root,
|
||||
unmount() {
|
||||
// Fix issues with race condition by delaying
|
||||
// the onLoad unmounting of containers
|
||||
// they would be unmounted later
|
||||
|
||||
if ( parseFloat( window.cf.config.wp_version ) >= 6.2 ) {
|
||||
const currentTime = Math.floor(Date.now() / 1000);
|
||||
if ( currentTime - rootRegistry[ containerId ].createdAt >= 3 ) {
|
||||
root.unmount();
|
||||
delete rootRegistry[ containerId ];
|
||||
}
|
||||
} else {
|
||||
root.unmount();
|
||||
delete rootRegistry[ containerId ];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function getContainerRoot( containerId ) {
|
||||
return rootRegistry[ containerId ] || null;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue