Created
March 2, 2016 08:53
-
-
Save hoangsetup/57e7a90bc3008938cdb8 to your computer and use it in GitHub Desktop.
Optimizing web fonts with Font Load Events API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof FontFace === 'function') { | |
var font = new FontFace('FontAwesome', 'url('+ config.url_dashboard +'widget/fonts/fontawesome-webfont.woff?v=4.2.0)', {}); | |
console.log('Time start FontFace: ' + (Date.now() - time_start) ); | |
font.load().then(function() { | |
console.log(('Time done FontFace: ' + (Date.now() - time_start) ); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developer.mozilla.org/en-US/docs/Web/API/FontFace