Details
-
Type:
Story
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 6.1.20 EE GA2
-
Fix Version/s: None
-
Component/s: UI, UI > JavaScript & CSS
-
Labels:None
-
Similar Issues:
Description
Currently we have two main objects in Liferay:
The Liferay object, and the cached AUI instance that's returned by AUI() (represented by the A variable inside of modules and use() callbacks).
This can be confusing at times, for instance:
AUI().use('aui-base', function(A)
);
In that case we're using the A instance, but then for some Liferay specific things not on the A instance, we use Liferay.
Instead, what we want to do is make Liferay actually be the publicly exposed variable for the cached instance. So rather than having to do AUI().one('#div') to do something outside of the callback, you would do: Liferay.one('#div').
There are multiple goals, short and long term, for this change:
1. Consolidate and remove all global Liferay variables outside of Liferay, such as themeDisplay and submitForm, and instead expose them as Liferay.ThemeDisplay and Liferay.submitForm
2. Have all of our javascript components actually be defined modules with declared dependencies. Currently, we have some files, such as Liferay.Util, Liferay.Address, Liferay.LayoutConfiguration, etc that are executed immediately on page load because we need them always available. However, this is doable and still allowing for them to be grouped as modules (where they'll explicitly state their dependencies).
3. Removing as many global variables as we can will make it easier to do 2 important things: A. Share javascript between iframes so that we don't have to re-execute a request for files that we've already downloaded and B. run multiple versions of a plugin side-by-side.
