Class BackgroundJavaScriptFactory
- java.lang.Object
-
- org.htmlunit.javascript.background.BackgroundJavaScriptFactory
-
public class BackgroundJavaScriptFactory extends java.lang.ObjectA factory for all the things we have to construct from outside the JavaScript engine.
-
-
Field Summary
Fields Modifier and Type Field Description private static BackgroundJavaScriptFactoryFactory_
-
Constructor Summary
Constructors Modifier Constructor Description protectedBackgroundJavaScriptFactory()The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JavaScriptExecutorcreateJavaScriptExecutor(WebClient webClient)Creates theJavaScriptExecutorthat will be used to handle JS.JavaScriptJobcreateJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.Runnable runnable)Creates a new job.JavaScriptJobcreateJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.String label, WebWindow window, java.lang.String script)Creates a new JavaScript execution job, where the JavaScript code to execute is a string.JavaScriptFunctionJobcreateJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.String label, WebWindow window, org.htmlunit.corejs.javascript.Function function, java.lang.Object[] args)Creates a new JavaScript execution job, where the JavaScript code to execute is a function.JavaScriptJobManagercreateJavaScriptJobManager(WebWindow webWindow)Creates a new JavaScriptJobManager for the given window.JavaScriptJobcreateJavascriptXMLHttpRequestJob(org.htmlunit.corejs.javascript.ContextFactory contextFactory, org.htmlunit.corejs.javascript.ContextAction<java.lang.Object> action)Creates a new job for XMLHttpRequestProcessing.static voidsetFactory(BackgroundJavaScriptFactory factory)Set the factory to a new one.static BackgroundJavaScriptFactorytheFactory()Returns the current factory.
-
-
-
Field Detail
-
Factory_
private static BackgroundJavaScriptFactory Factory_
-
-
Method Detail
-
theFactory
public static BackgroundJavaScriptFactory theFactory()
Returns the current factory.- Returns:
- the active factory
-
setFactory
public static void setFactory(BackgroundJavaScriptFactory factory)
Set the factory to a new one.- Parameters:
factory- the new factory.
-
createJavaScriptJob
public JavaScriptJob createJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.String label, WebWindow window, java.lang.String script)
Creates a new JavaScript execution job, where the JavaScript code to execute is a string.- Parameters:
initialDelay- the initial amount of time to wait before executing this jobperiod- the amount of time to wait between executions of this job (maybenull)label- the label for the jobwindow- the window to which the job belongsscript- the JavaScript code to execute- Returns:
- JavaScriptJob the created job
-
createJavaScriptJob
public JavaScriptFunctionJob createJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.String label, WebWindow window, org.htmlunit.corejs.javascript.Function function, java.lang.Object[] args)
Creates a new JavaScript execution job, where the JavaScript code to execute is a function.- Parameters:
initialDelay- the initial amount of time to wait before executing this jobperiod- the amount of time to wait between executions of this job (maybenull)label- the label for the jobwindow- the window to which the job belongsfunction- the JavaScript code to executeargs- the arguments to pass into the function call- Returns:
- JavaScriptJob the created job
-
createJavascriptXMLHttpRequestJob
public JavaScriptJob createJavascriptXMLHttpRequestJob(org.htmlunit.corejs.javascript.ContextFactory contextFactory, org.htmlunit.corejs.javascript.ContextAction<java.lang.Object> action)
Creates a new job for XMLHttpRequestProcessing.- Parameters:
contextFactory- the ContextFactoryaction- the action- Returns:
- JavaScriptJob the created job
-
createJavaScriptJob
public JavaScriptJob createJavaScriptJob(int initialDelay, java.lang.Integer period, java.lang.Runnable runnable)
Creates a new job.- Parameters:
initialDelay- the initial amount of time to wait before executing this jobperiod- the amount of time to wait between executions of this job (maybenull)runnable- the runnable to run- Returns:
- JavaScriptJob the created job
-
createJavaScriptExecutor
public JavaScriptExecutor createJavaScriptExecutor(WebClient webClient)
Creates theJavaScriptExecutorthat will be used to handle JS.- Parameters:
webClient- the WebClient of the executor- Returns:
- the executor.
-
createJavaScriptJobManager
public JavaScriptJobManager createJavaScriptJobManager(WebWindow webWindow)
Creates a new JavaScriptJobManager for the given window.- Parameters:
webWindow- the window the JavaScriptJobManager will work for- Returns:
- the new JavaScriptJobManager
-
-