public class ResourceLoader extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ResourceLoader.ResourceLoadEvent
Event fired when a resource has been loaded.
|
static interface |
ResourceLoader.ResourceLoadListener
Event listener that gets notified when a resource has been loaded.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ResourceLoader()
Creates a new resource loader.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addOnloadHandler(com.google.gwt.dom.client.Element element,
ResourceLoader.ResourceLoadListener listener,
ResourceLoader.ResourceLoadEvent event)
Adds an onload listener to the given element, which should be a link or a
script tag.
|
static ResourceLoader |
get()
Returns the default ResourceLoader.
|
void |
loadHtmlImport(String htmlUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Loads an HTML import and notify a listener when the HTML import is
loaded.
|
void |
loadScript(String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Load a script and notify a listener when the script is loaded.
|
void |
loadStylesheet(String stylesheetUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Load a stylesheet and notify a listener when the stylesheet is loaded.
|
protected void |
runWhenHtmlImportsReady(Runnable runnable)
Executes a Runnable when all HTML imports are ready.
|
protected ResourceLoader()
get() to get an
instance.public static ResourceLoader get()
public void loadScript(String scriptUrl, ResourceLoader.ResourceLoadListener resourceLoadListener)
scriptUrl - the url of the script to loadresourceLoadListener - the listener that will get notified when the script is loadedpublic void loadHtmlImport(String htmlUrl, ResourceLoader.ResourceLoadListener resourceLoadListener)
htmlUrl - url of HTML import to loadresourceLoadListener - listener to notify when the HTML import is loadedpublic static void addOnloadHandler(com.google.gwt.dom.client.Element element,
ResourceLoader.ResourceLoadListener listener,
ResourceLoader.ResourceLoadEvent event)
element - the element to attach a listener tolistener - the listener to callevent - the event passed to the listenerpublic void loadStylesheet(String stylesheetUrl, ResourceLoader.ResourceLoadListener resourceLoadListener)
stylesheetUrl - the url of the stylesheet to loadresourceLoadListener - the listener that will get notified when the stylesheet is
loadedprotected void runWhenHtmlImportsReady(Runnable runnable)
runnable - the code to executeCopyright © 2023 Vaadin Ltd. All rights reserved.