webfontloadeddetector

0.0.1 • Public • Published

WebFontLoadedDetector Dependency Status devDependency Status Build Status

Detects wether a webfont has been loaded via string width comparison.

Install

With npm, use the familiar syntax e.g.:

npm install webfontloadeddetector --save

once the WebfontJSON package is installed, just require it in the main application file.

var WebFontLoadedDetector = require("WebFontLoadedDetector");

This package also supports AMD/RequireJS, it is defined as webfontloadeddetector. Aren't using AMD/CommonJS? Just grab a release, include the Dist/WebFontLoadedDetector.min.js and access the loader via the following global:

var WebFontLoadedDetector = window.WebFontLoadedDetector;

Configuration

In the main application file, create a new instance of the Constructor e.g.:

// Initialize a new instance of the WebFontLoadedDetector.
var detector = new WebFontLoadedDetector({
    targetFontFamily: 'Arial'
});
 
// Get the result.
var result = detector.isFontLoaded();

Options

options.targetFontFamily

Type: String

The font-family to which will be tested.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.

API

detector.isFontLoaded()

Type: Function

Returns a boolean wether the font-family was loaded or not.

detector.destroy()

Type: Function

Removes the test element which was inserted into the DOM while creating the instance.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.

/webfontloadeddetector/

    Package Sidebar

    Install

    npm i webfontloadeddetector

    Weekly Downloads

    22

    Version

    0.0.1

    License

    ISC

    Last publish

    Collaborators

    • inkdpixels