@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
24 lines (23 loc) • 1.18 kB
JavaScript
const doOnceFlags = {};
/**
* If the key was passed before, then do NOT execute the func
*/
const doOnce = (func, key) => {
if (doOnceFlags[key]) {
return;
}
func();
doOnceFlags[key] = true;
};
export const logDeprecation = (logger, typeName, oldProp, newProp, message) => {
const newPropMsg = newProp ? `Please use '${typeName}.${newProp}()' instead. ` : '';
doOnce(() => logger.consoleWarn(`'${typeName}.${oldProp}()' is deprecated. ${newPropMsg}${message ?? ''}`), `Deprecated_${oldProp}`);
};
export const logDeprecationExternal = (logger, oldTypeName, oldProp, newTypeName, newProp, message) => {
const newPropMsg = newProp ? `Please use '${newTypeName}.${newProp}()' instead. ` : '';
doOnce(() => logger.consoleWarn(`'${oldTypeName}.${oldProp}()' is deprecated. ${newPropMsg}${message ?? ''}`), `Deprecated_${oldProp}`);
};
export const logDeprecationInternal = (logger, typeName, oldProp) => {
doOnce(() => logger.consoleWarn(`'${typeName}.${oldProp}()' is deprecated. The method will be removed in the next major release.
Please contact support if you need the missing functionality.`), `Deprecated_${oldProp}`);
};