public void loadWithTimeout ( int timeout ) { for ( String stylesheet : m_stylesheets ) { boolean alreadyLoaded = checkStylesheet ( stylesheet ) ; if ( alreadyLoaded ) { m_loadCounter += 1 ; } else { appendStylesheet ( stylesheet , m_jsCallback ) ; } } checkAllLoaded ( ) ; if ( timeout > 0 ) { Timer timer = new Timer ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public void run ( ) { callCallback ( ) ; } } ; timer . schedule ( timeout ) ; } }
Starts the loading process and creates a timer that sets of the callback after a given tiime if it hasn t already been triggered .