2019-07-03 15:38:25 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
2021-02-25 12:21:03 +00:00
|
|
|
let filterSupport;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks context filter support.
|
|
|
|
*
|
|
|
|
* @returns {boolean} True if the filter is supported and false if the filter is not supported by the browser.
|
|
|
|
*/
|
|
|
|
export function checkBlurSupport() {
|
|
|
|
if (typeof filterSupport === 'undefined') {
|
|
|
|
const canvas = document.createElement('canvas');
|
|
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
|
|
|
|
filterSupport = typeof ctx.filter !== 'undefined';
|
|
|
|
|
|
|
|
canvas.remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
return filterSupport;
|
|
|
|
}
|