我使用网络字体加载器作为模块:
var WebFont = require('webfontloader');
WebFont.load({
google: {
families: ['Droid Sans', 'Droid Serif']
}
});
如何找出所有字体何时处于活动状态?
我尝试添加:
WebFontConfig = {
active: function() {
console.log('fonts ok');
}
}
但是得到错误:
Uncaught ReferenceError: WebFontConfig is not defined
答案 0 :(得分:3)
使用此代码:
var WebFont = require('webfontloader');
WebFont.load({
google: {
families: ['Droid Sans', 'Droid Serif']
},
active: function(){
//when fonts loaded
console.log('fonts loaded');
}
});