bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
58 lines (53 loc) • 1.38 kB
JavaScript
import { IS_BROWSER, HAS_PROMISE_SUPPORT, HAS_MUTATION_OBSERVER_SUPPORT } from '../constants/env'
import { getNoWarn } from './env'
/**
* Log a warning message to the console with BootstrapVue formatting
* @param {string} message
*/
export const warn = (message, source = null) => /* istanbul ignore next */ {
if (!getNoWarn()) {
console.warn(`[BootstrapVue warn]: ${source ? `${source} - ` : ''}${message}`)
}
}
/**
* Warn when no Promise support is given
* @param {string} source
* @returns {boolean} warned
*/
export const warnNotClient = source => {
/* istanbul ignore else */
if (IS_BROWSER) {
return false
} else {
warn(`${source}: Can not be called during SSR.`)
return true
}
}
/**
* Warn when no Promise support is given
* @param {string} source
* @returns {boolean} warned
*/
export const warnNoPromiseSupport = source => {
/* istanbul ignore else */
if (HAS_PROMISE_SUPPORT) {
return false
} else {
warn(`${source}: Requires Promise support.`)
return true
}
}
/**
* Warn when no MutationObserver support is given
* @param {string} source
* @returns {boolean} warned
*/
export const warnNoMutationObserverSupport = source => {
/* istanbul ignore else */
if (HAS_MUTATION_OBSERVER_SUPPORT) {
return false
} else {
warn(`${source}: Requires MutationObserver support.`)
return true
}
}