UNPKG

@pegakit/pegakit

Version:

The living styleguide, pattern library, UI ToolKit, and front-end build tools that power Pega's digital web properties.

73 lines (53 loc) 1.93 kB
if( sessionStorage.criticalFoftFontsLoaded ) { document.documentElement.className += ' fonts-loaded'; } else { // var loadFonts = function(){ var FontFaceObserver = require('fontfaceobserver/fontfaceobserver.js'); var openSansLight = new FontFaceObserver('Open Sans', { weight: 300 }); var openSansRegular = new FontFaceObserver('Open Sans', { weight: 400 }); var openSansItalic = new FontFaceObserver('Open Sans', { weight: 400, style: 'italic' }); var openSansBold = new FontFaceObserver('Open Sans', { weight: 700 }); var exo2Light = new FontFaceObserver('Exo 2', { weight: 300 }); // var exo2Regular = new FontFaceObserver('Exo 2', { // weight: 400 // }); // // var exoSemiBold = new FontFaceObserver('Exo 2', { // weight: 600 // }); var glyphicons = new FontFaceObserver('Glyphicons Halflings', { weight: 400 }); var fontAwesome = new FontFaceObserver('FontAwesome', { weight: 400 }); Promise.all([ exo2Light.load(null, 5000), // exo2Regular.load(null, 5000), // exoSemiBold.load(null, 5000), openSansLight.load(null, 5000), openSansRegular.load(null, 5000), openSansItalic.load(null, 5000), openSansBold.load(null, 5000), glyphicons.load('\ue003', 5000), fontAwesome.load('\f099', 5000) ]).then(function () { document.documentElement.className += ' fonts-loaded'; // // Optimization for Repeat Views sessionStorage.criticalFoftFontsLoaded = true; }, function(err){ document.documentElement.className += ' fonts-loaded'; sessionStorage.criticalFoftFontsLoaded = true; }); }