001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.services.javascript;
014
015/**
016 * Sets the priority for JavaScript initialization scripting. InitializationPriority allows coarse-grained control
017 * over the order in which initialization occurs on the client. The default is normally {@link #NORMAL}. Starting in 5.4,
018 * these values have less meaning, as the {@linkplain JavaScriptSupport#require(String) dynamic loading of modules} may
019 * have unexpected effects on the exact order in which initialization occurs as some initializations may be deferred until
020 * a referenced module, or a dependency of a referenced module, has been loaded.
021 *
022 * @since 5.2.0
023 */
024public enum InitializationPriority
025{
026    /**
027     * Provided JavaScript will be executed immediately (it is not deferred until the page loads). Execution occur via
028     * JavaScript's {@code eval}, and occurs once all {@linkplain JavaScriptSupport#importJavaScriptLibrary(org.apache.tapestry5.Asset) JavaScript libraries}
029     * (but not modules) for the page have been loaded.
030     *
031     *
032     * @deprecated Deprecated in 5.4; this is now treated as "earlier than {@linkplain #EARLY early}".
033     */
034    IMMEDIATE,
035
036    /**
037     * All early execution occurs before {@link #NORMAL}.
038     */
039    EARLY,
040
041    /**
042     * This is the typical priority.
043     */
044    NORMAL,
045
046    /**
047     * Execution occurs after {@link #NORMAL}.
048     */
049    LATE
050}