fontfaceobserver
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,6 +0,1 @@ | ||
(function(){'use strict';function f(a){this.a=k;this.b=void 0;this.d=[];var b=this;try{a(function(a){l(b,a)},function(a){m(b,a)})}catch(c){m(b,c)}}var k=2;function n(a){return new f(function(b,c){c(a)})}function p(a){return new f(function(b){b(a)})} | ||
function l(a,b){if(a.a===k){if(b===a)throw new TypeError("Promise resolved with itself.");var c=!1;try{var d=b&&b.then;if(null!==b&&"object"===typeof b&&"function"===typeof d){d.call(b,function(b){c||l(a,b);c=!0},function(b){c||m(a,b);c=!0});return}}catch(e){c||m(a,e);return}a.a=0;a.b=b;q(a)}}function m(a,b){if(a.a===k){if(b===a)throw new TypeError("Promise rejected with itself.");a.a=1;a.b=b;q(a)}} | ||
function q(a){setTimeout(function(){if(a.a!==k)for(;a.d.length;){var b=a.d.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0===a.a?"function"===typeof c?e(c.call(void 0,a.b)):e(a.b):1===a.a&&("function"===typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(g){b(g)}}},0)}f.prototype.e=function(a){return this.c(void 0,a)};f.prototype.c=function(a,b){var c=this;return new f(function(d,e){c.d.push([a,b,d,e]);q(c)})}; | ||
function r(a){return new f(function(b,c){function d(c){return function(d){g[c]=d;e+=1;e===a.length&&b(g)}}var e=0,g=[];0===a.length&&b(g);for(var h=0;h<a.length;h+=1)a[h].c(d(h),c)})}function s(a){return new f(function(b,c){for(var d=0;d<a.length;d+=1)a[d].c(b,c)})};window.Promise||(window.Promise=f,window.Promise.resolve=p,window.Promise.reject=n,window.Promise.race=s,window.Promise.all=r,window.Promise.prototype.then=f.prototype.c,window.Promise.prototype["catch"]=f.prototype.e);}()); | ||
(function(){'use strict';function e(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.f=document.createElement("span");this.d=document.createElement("span");this.e=-1;this.b.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;";this.c.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;"; | ||
@@ -7,0 +2,0 @@ this.d.style.cssText="display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;";this.f.style.cssText="display:inline-block;width:200%;height:200%;";this.b.appendChild(this.f);this.c.appendChild(this.d);this.a.appendChild(this.b);this.a.appendChild(this.c)}function n(a,b,c){a.a.style.cssText="min-width:20px;min-height:20px;display:inline-block;visibility:hidden;position:absolute;width:auto;margin:0;padding:0;top:0;white-space:nowrap;font-size:300px;font-family:"+b+";"+c} |
@@ -74,4 +74,8 @@ var extend = require('extend'); | ||
concat: { | ||
dist_standalone: { | ||
src: ['node_modules/promis/promise.js', 'build/fontfaceobserver.js'], | ||
dest: 'fontfaceobserver.standalone.js' | ||
}, | ||
dist: { | ||
src: ['node_modules/promis/promise.js', 'build/fontfaceobserver.js'], | ||
src: ['build/fontfaceobserver.js'], | ||
dest: 'fontfaceobserver.js' | ||
@@ -95,3 +99,3 @@ } | ||
grunt.registerTask('dev', ['connect', 'watch']); | ||
grunt.registerTask('dist', ['clean', 'closurecompiler:compile', 'concat:dist']); | ||
grunt.registerTask('dist', ['clean', 'closurecompiler:compile', 'concat:dist', 'concat:dist_standalone']); | ||
}; |
{ | ||
"name": "fontfaceobserver", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Detect if web fonts are available", | ||
@@ -5,0 +5,0 @@ "directories": { |
# Font Face Observer | ||
Font Face Observer is a small `@font-face` loader and monitor (3.5Kb minified and 1.4Kb gzipped) compatible with any web-font service. It will monitor when a web font is applied to the page and notify you. It does not limit you in any way in where, when, or how you load your web fonts. Unlike the [Web Font Loader](https://github.com/typekit/webfontloader) Font Face Observer uses scroll events to detect font loads efficiently and with minimum overhead. | ||
Font Face Observer is a small `@font-face` loader and monitor (2.7KB minified and 1.1KB gzipped) compatible with any web-font service. It will monitor when a web font is applied to the page and notify you. It does not limit you in any way in where, when, or how you load your web fonts. Unlike the [Web Font Loader](https://github.com/typekit/webfontloader) Font Face Observer uses scroll events to detect font loads efficiently and with minimum overhead. | ||
@@ -31,2 +31,12 @@ ## How to use | ||
## Installation | ||
If you're using npm you can install Font Face Observer as a dependency: | ||
> npm install fontfaceobserver | ||
You can then either include `fontfaceobserver.js` or `fontfaceobserver.standalone.js`. The former is Font Face Observer without dependencies. The latter includes a small [promise polyfill](https://github.com/bramstein/promis). | ||
If you're not using npm, grab either `fontfaceobserver.js` or `fontfaceobserver.standalone.js` and include it in your project. | ||
## Browser support | ||
@@ -33,0 +43,0 @@ |
297701
26
3866
55