Skip to content

Commit

Permalink
[core] Misc modules/* cleanup (#22983)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Oct 12, 2020
1 parent fa343f9 commit 20f6450
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 533 deletions.
49 changes: 24 additions & 25 deletions docs/src/modules/components/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import ClickAwayListener from '@material-ui/core/ClickAwayListener';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import Divider from '@material-ui/core/Divider';
import sleep from 'modules/waterfall/sleep';
import { getCookie } from 'docs/src/modules/utils/helpers';
import { ACTION_TYPES } from 'docs/src/modules/constants';

Expand Down Expand Up @@ -91,33 +90,33 @@ export default function Notifications() {
return undefined;
}

(async () => {
await sleep(1500); // Soften the pressure on the main thread.
let newMessages;
try {
const result = await fetch(
'https://raw.githubusercontent.com/mui-org/material-ui/master/docs/notifications.json',
);
newMessages = await result.json();
} catch (err) {
// Swallow the exceptions, e.g. rate limit
}

if (active) {
const seen = getCookie('lastSeenNotification');
const lastSeenNotification = seen === '' ? 0 : parseInt(seen, 10);

dispatch({
type: ACTION_TYPES.NOTIFICATIONS_CHANGE,
payload: {
messages: newMessages || [],
lastSeen: lastSeenNotification,
},
// Soften the pressure on the main thread.
const timeout = setTimeout(() => {
fetch('https://raw.githubusercontent.com/mui-org/material-ui/master/docs/notifications.json')
.then((response) => {
return response.json();
})
.catch(() => {
// Swallow the exceptions, e.g. rate limit
return [];
})
.then((newMessages) => {
if (active) {
const seen = getCookie('lastSeenNotification');
const lastSeenNotification = seen === '' ? 0 : parseInt(seen, 10);
dispatch({
type: ACTION_TYPES.NOTIFICATIONS_CHANGE,
payload: {
messages: newMessages || [],
lastSeen: lastSeenNotification,
},
});
}
});
}
})();
}, 1500);

return () => {
clearTimeout(timeout);
active = false;
};
}, []);
Expand Down
112 changes: 0 additions & 112 deletions modules/handleKillSignals.js

This file was deleted.

146 changes: 0 additions & 146 deletions modules/log.js

This file was deleted.

47 changes: 0 additions & 47 deletions modules/waterfall/Batcher.js

This file was deleted.

8 changes: 0 additions & 8 deletions modules/waterfall/forEach.js

This file was deleted.

Loading

0 comments on commit 20f6450

Please sign in to comment.