/onloadCSS.js

From disqus.com, 1 Year ago, written in JavaScript, viewed 3 times. This paste is a reply to loadCSS.js from disqus.com - view diff
URL https://pastebin.freepbx.org/view/0b3dd558 Embed
Download Paste or View Raw
  1. /*! onloadCSS: adds onload support for asynchronous stylesheets loaded with loadCSS. [c]2016 @zachleat, Filament Group, Inc. Licensed MIT */
  2. /* global navigator */
  3. /* exported onloadCSS */
  4. function onloadCSS( ss, callback ) {
  5.         var called;
  6.         function newcb(){
  7.                         if( !called && callback ){
  8.                                 called = true;
  9.                                 callback.call( ss );
  10.                         }
  11.         }
  12.         if( ss.addEventListener ){
  13.                 ss.addEventListener( "load", newcb );
  14.         }
  15.         if( ss.attachEvent ){
  16.                 ss.attachEvent( "onload", newcb );
  17.         }
  18.  
  19.         // This code is for browsers that don’t support onload
  20.         // No support for onload (it'll bind but never fire):
  21.         //      * Android 4.3 (Samsung Galaxy S4, Browserstack)
  22.         //      * Android 4.2 Browser (Samsung Galaxy SIII Mini GT-I8200L)
  23.         //      * Android 2.3 (Pantech Burst P9070)
  24.  
  25.         // Weak inference targets Android < 4.4
  26.         if( "isApplicationInstalled" in navigator && "onloadcssdefined" in ss ) {
  27.                 ss.onloadcssdefined( newcb );
  28.         }
  29. }
  30.  
  31.  
  32. /*** EXPORTS FROM exports-loader ***/
  33. module.exports = onloadCSS
  34.  
  35.  
  36. //////////////////
  37. // WEBPACK FOOTER
  38. // ../~/exports-loader?onloadCSS!../~/fg-loadcss/src/onloadCSS.js
  39. // module id = 486
  40. // module chunks = 0

Reply to "/onloadCSS.js"

Here you can reply to the paste above