mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
guard window
This commit is contained in:
parent
8729808625
commit
c9bea3019b
7
index.js
7
index.js
@ -2,7 +2,8 @@ require('./style/index.less');
|
|||||||
|
|
||||||
// matchMedia polyfill for
|
// matchMedia polyfill for
|
||||||
// https://github.com/WickyNilliams/enquire.js/issues/82
|
// https://github.com/WickyNilliams/enquire.js/issues/82
|
||||||
window.matchMedia = window.matchMedia || function () {
|
if (typeof window !== 'undefined') {
|
||||||
|
const matchMediaPolyfill = function matchMediaPolyfill() {
|
||||||
return {
|
return {
|
||||||
matches: false,
|
matches: false,
|
||||||
addListener: function () {
|
addListener: function () {
|
||||||
@ -10,7 +11,9 @@ window.matchMedia = window.matchMedia || function () {
|
|||||||
removeListener: function () {
|
removeListener: function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
window.matchMedia = window.matchMedia || matchMediaPolyfill;
|
||||||
|
}
|
||||||
|
|
||||||
const antd = {
|
const antd = {
|
||||||
Affix: require('./components/affix'),
|
Affix: require('./components/affix'),
|
||||||
|
Loading…
Reference in New Issue
Block a user