All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.htmlunit.javascript.host.xml.XMLHttpRequestEventTarget Maven / Gradle / Ivy

Go to download

XLT (Xceptance LoadTest) is an extensive load and performance test tool developed and maintained by Xceptance.

There is a newer version: 8.4.1
Show newest version
/*
 * Copyright (c) 2002-2024 Gargoyle Software Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.htmlunit.javascript.host.xml;

import static org.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
import static org.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF_ESR;

import org.htmlunit.corejs.javascript.Function;
import org.htmlunit.javascript.JavaScriptEngine;
import org.htmlunit.javascript.configuration.JsxClass;
import org.htmlunit.javascript.configuration.JsxConstructor;
import org.htmlunit.javascript.configuration.JsxGetter;
import org.htmlunit.javascript.configuration.JsxSetter;
import org.htmlunit.javascript.host.event.Event;
import org.htmlunit.javascript.host.event.EventTarget;

/**
 * A JavaScript object for {@code XMLHttpRequestEventTarget}.
 *
 * @author Ahmed Ashour
 * @author Ronald Brill
 * @author Thorsten Wendelmuth
 * @author Atsushi Nakagawa
 */
@JsxClass
public class XMLHttpRequestEventTarget extends EventTarget {

    /**
     * Creates an instance.
     */
    public XMLHttpRequestEventTarget() {
    }

    /**
     * JavaScript constructor.
     */
    @Override
    @JsxConstructor({CHROME, EDGE, FF, FF_ESR})
    public void jsConstructor() {
        throw JavaScriptEngine.typeError("Illegal constructor.");
    }

    /**
     * Returns the event handler that fires on load.
     * @return the event handler that fires on load
     */
    @JsxGetter
    public Function getOnload() {
        return getEventHandler(Event.TYPE_LOAD);
    }

    /**
     * Sets the event handler that fires on load.
     * @param loadHandler the event handler that fires on load
     */
    @JsxSetter
    public void setOnload(final Function loadHandler) {
        setEventHandler(Event.TYPE_LOAD, loadHandler);
    }

    /**
     * Returns the event handler that fires on error.
     * @return the event handler that fires on error
     */
    @JsxGetter
    public Function getOnerror() {
        return getEventHandler(Event.TYPE_ERROR);
    }

    /**
     * Sets the event handler that fires on error.
     * @param errorHandler the event handler that fires on error
     */
    @JsxSetter
    public void setOnerror(final Function errorHandler) {
        setEventHandler(Event.TYPE_ERROR, errorHandler);
    }

    /**
     * Returns the event handler that fires on load start.
     * @return the event handler that fires on load start
     */
    @JsxGetter
    public Function getOnloadstart() {
        return getEventHandler(Event.TYPE_LOAD_START);
    }

    /**
     * Sets the event handler that fires on load start.
     * @param loadstartHandler the event handler that fires on load start
     */
    @JsxSetter
    public void setOnloadstart(final Function loadstartHandler) {
        setEventHandler(Event.TYPE_LOAD_START, loadstartHandler);
    }

    /**
     * Returns the event handler that fires on load end.
     * @return the event handler that fires on load end
     */
    @JsxGetter
    public Function getOnloadend() {
        return getEventHandler(Event.TYPE_LOAD_END);
    }

    /**
     * Sets the event handler that fires on load end.
     * @param loadendHandler the event handler that fires on load end
     */
    @JsxSetter
    public void setOnloadend(final Function loadendHandler) {
        setEventHandler(Event.TYPE_LOAD_END, loadendHandler);
    }

    /**
     * Returns the event handler that fires on progress.
     * @return the event handler that fires on progress
     */
    @JsxGetter
    public Function getOnprogress() {
        return getEventHandler(Event.TYPE_PROGRESS);
    }

    /**
     * Sets the event handler that fires on progress.
     * @param progressHandler the event handler that fires on progress
     */
    @JsxSetter
    public void setOnprogress(final Function progressHandler) {
        setEventHandler(Event.TYPE_PROGRESS, progressHandler);
    }

    /**
     * Returns the event handler that fires on timeout.
     * @return the event handler that fires on timeout
     */
    @JsxGetter
    public Function getOntimeout() {
        return getEventHandler(Event.TYPE_TIMEOUT);
    }

    /**
     * Sets the event handler that fires on timeout.
     * @param timeoutHandler the event handler that fires on timeout
     */
    @JsxSetter
    public void setOntimeout(final Function timeoutHandler) {
        setEventHandler(Event.TYPE_TIMEOUT, timeoutHandler);
    }

    /**
     * Returns the event handler that fires on ready state change.
     * @return the event handler that fires on ready state change
     */
    public Function getOnreadystatechange() {
        return getEventHandler(Event.TYPE_READY_STATE_CHANGE);
    }

    /**
     * Sets the event handler that fires on ready state change.
     * @param readyStateChangeHandler the event handler that fires on ready state change
     */
    public void setOnreadystatechange(final Function readyStateChangeHandler) {
        setEventHandler(Event.TYPE_READY_STATE_CHANGE, readyStateChangeHandler);
    }

    /**
     * Returns the event handler that fires on abort.
     * @return the event handler that fires on abort
     */
    @JsxGetter
    public Function getOnabort() {
        return getEventHandler(Event.TYPE_ABORT);
    }

    /**
     * Sets the event handler that fires on abort.
     * @param abortHandler the event handler that fires on abort
     */
    @JsxSetter
    public void setOnabort(final Function abortHandler) {
        setEventHandler(Event.TYPE_ABORT, abortHandler);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy