guard window

This commit is contained in:
yiminghe 2015-10-26 20:03:37 +08:00
parent 8729808625
commit c9bea3019b

View File

@ -2,15 +2,18 @@ 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') {
return { const matchMediaPolyfill = function matchMediaPolyfill() {
matches: false, return {
addListener: function () { matches: false,
}, addListener: function () {
removeListener: function () { },
} removeListener: function () {
}
};
}; };
}; window.matchMedia = window.matchMedia || matchMediaPolyfill;
}
const antd = { const antd = {
Affix: require('./components/affix'), Affix: require('./components/affix'),