Colocate reducers, actions and selectors
This commit is contained in:
parent
1e7d4c3fe4
commit
889e3b88b7
53 changed files with 1031 additions and 914 deletions
22
client/src/js/modules/fonts.js
Normal file
22
client/src/js/modules/fonts.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import FontFaceObserver from 'fontfaceobserver';
|
||||
import { setCharWidth } from '../state/environment';
|
||||
import { stringWidth } from '../util';
|
||||
|
||||
export default function fonts({ store }) {
|
||||
let charWidth = localStorage.charWidth;
|
||||
if (charWidth) {
|
||||
store.dispatch(setCharWidth(parseFloat(charWidth)));
|
||||
}
|
||||
|
||||
new FontFaceObserver('Roboto Mono').load().then(() => {
|
||||
if (!charWidth) {
|
||||
charWidth = stringWidth(' ', '16px Roboto Mono');
|
||||
store.dispatch(setCharWidth(charWidth));
|
||||
localStorage.charWidth = charWidth;
|
||||
}
|
||||
});
|
||||
|
||||
new FontFaceObserver('Montserrat').load();
|
||||
new FontFaceObserver('Montserrat', { weight: 700 }).load();
|
||||
new FontFaceObserver('Roboto Mono', { weight: 700 }).load();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue