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 015import org.apache.tapestry5.ioc.services.SymbolSource; 016import org.apache.tapestry5.services.AssetSource; 017 018/** 019 * Defines the types of extensions to a JavaScript stack that can be contributed to an extensible JavaScript stack. 020 * 021 * @see StackExtension 022 * @see ExtensibleJavaScriptStack 023 * @since 5.3 024 */ 025public enum StackExtensionType 026{ 027 /** 028 * A JavaScript library. The extension value will be converted using {@link AssetSource#getExpandedAsset(String)}, 029 * meaning that {@linkplain SymbolSource symbols} will be expanded. 030 * 031 * @see JavaScriptSupport#importJavaScriptLibrary(org.apache.tapestry5.Asset) 032 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getJavaScriptLibraries() 033 */ 034 LIBRARY, 035 036 /** 037 * A dependency on another JavaScriptStack. Note that this is especially useful as, starting in 5.4, there is 038 * no automatic dependency on the "core" stack, as there was in earlier versions. 039 * 040 * @see JavaScriptSupport#importStack(String) 041 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getStylesheets() 042 * @since 5.4 043 */ 044 STACK, 045 046 /** 047 * A stylesheet. The extension value will be converted using {@link AssetSource#getExpandedAsset(String)}, 048 * meaning that {@linkplain SymbolSource symbols} will be expanded. 049 * 050 * @see JavaScriptSupport#importStylesheet(org.apache.tapestry5.Asset) 051 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getStylesheets() 052 */ 053 STYLESHEET, 054 055 /** 056 * A module to aggregate with the stack. The module's JavaScript is included after any libraries. 057 * In development mode (with aggregation disabled), the library will be included individually. 058 * Unlike the RequireJS {@code r.js} tool, this does not process 059 * dependencies and is based on a simple regular expression parser. 060 * 061 * Note that this only loads the module's <em>code</em> and defines the module as available; 062 * the module's function will not be invoked unless {@link JavaScriptSupport#require(String)} is invoked to establish 063 * a dependency. 064 * 065 * Note that at this time, {@linkplain JavaScriptModuleConfiguration#exports(String) shimmed modules} can not 066 * be aggregated into stacks properly; the shimmed module will be aggregated, but then will still be loaded via 067 * a subsequent HTTP request. 068 * 069 * @since 5.4 070 */ 071 MODULE, 072 073 /** 074 * Overrides the {@linkplain JavaScriptStack#getJavaScriptAggregationStrategy() JavaScript aggregation strategy} 075 * for the stack. The value is string name of an {@link org.apache.tapestry5.services.javascript.JavaScriptAggregationStrategy} value. 076 * 077 * @since 5.4 078 */ 079 AGGREGATION_STRATEGY, 080 081 /** 082 * Extra JavaScript initialization (rarely used). No symbol expansion takes place. 083 * 084 * @see JavaScriptSupport#addScript(String, Object...) 085 * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getInitialization() 086 * @deprecated Deprecated in 5.4 with no replacement; initialization may be removed in the future. 087 */ 088 INITIALIZATION; 089}