FontLoader icon indicating copy to clipboard operation
FontLoader copied to clipboard

Calling FontLoader multiple times

Open DangerD256 opened this issue 8 years ago • 0 comments

Need to load fonts by ajax call, first time function works well, second and next times function returns success instantly.

jQuery.ajax({
    type: "POST",
    url: ajax_url,
    data: 'act=getFont&name='+font,
    success: function(data) 
    {
        var fontLoader = new FontLoader([font], {
            "fontLoaded": function(font) {
            },
            "complete": function(error) {
                if (error !== null) {
                } else {
                    // All fonts were loaded
                    console.log('loaded!! ->'+font);
                    loader(0);
                    canvas.getActiveObject().setFontFamily(font);
                    canvas.renderAll();
                    },1000);
                }
            }
        }, 3000);
        fontLoader.loadFonts();
        jQuery('body').append(data);
    }
});

DangerD256 avatar Sep 29 '16 06:09 DangerD256