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 |
loadScript(String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Load a script and notify a listener when the script is loaded.
|
void |
loadScript(String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener,
boolean async)
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.
|
void |
preloadResource(String url,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Download a resource and notify a listener when the resource is loaded
without attempting to interpret the resource.
|
static boolean |
supportsInOrderScriptExecution()
The current browser supports script.async='false' for maintaining
execution order for dynamically-added scripts.
|
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 loadScript(String scriptUrl, ResourceLoader.ResourceLoadListener resourceLoadListener, boolean async)
scriptUrl - url of script to loadresourceLoadListener - listener to notify when script is loadedasync - What mode the script.async attribute should be set topublic static boolean supportsInOrderScriptExecution()
public void preloadResource(String url, ResourceLoader.ResourceLoadListener resourceLoadListener)
url - the url of the resource to preloadresourceLoadListener - the listener that will get notified when the resource is
preloadedpublic 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
loadedCopyright © 2016 Vaadin Ltd. All rights reserved.