PageSourceSearch

https://tem.fi/o/frontend-js-aui-web/liferay/dependency.js

js tem.fi collected 2026-10-02 03:16:53 UTC 2,871 bytes, 113 lines download raw bytes

1/**
2 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
3 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
4 */
5(function () {
6  var A = AUI().use('oop');
7  var usedModules = {};
8  var Dependency = {
9    _getAOP: function _getAOP(obj, methodName) {
10      return obj._yuiaop && obj._yuiaop[methodName];
11    },
12    _proxy: function _proxy(obj, methodName, methodFn, context, guid, modules, _A) {
13      var args;
14      var queue = Dependency._proxyLoaders[guid];
15
16      Dependency._replaceMethod(obj, methodName, methodFn, context);
17
18      while (args = queue.next()) {
19        methodFn.apply(context, args);
20      }
21
22      for (var i = modules.length - 1; i >= 0; i--) {
23        usedModules[modules[i]] = true;
24      }
25    },
26    _proxyLoaders: {},
27    _replaceMethod: function _replaceMethod(obj, methodName, methodFn) {
28      var AOP = Dependency._getAOP(obj, methodName);
29
30      var proxy = obj[methodName];
31
32      if (AOP) {
33        proxy = AOP.method;
34        AOP.method = methodFn;
35      } else {
36        obj[methodName] = methodFn;
37      }
38
39      A.mix(methodFn, proxy);
40    },
41    provide: function provide(obj, methodName, methodFn, modules, proto) {
42      if (!Array.isArray(modules)) {
43        modules = [modules];
44      }
45
46      var before;
47      var guid = A.guid();
48
49      if (A.Lang.isObject(methodFn, true)) {
50        var config = methodFn;
51        methodFn = config.fn;
52        before = config.before;
53
54        if (!A.Lang.isFunction(before)) {
55          before = null;
56        }
57      }
58
59      if (proto && A.Lang.isFunction(obj)) {
60        obj = obj.prototype;
61      }
62
63      var AOP = Dependency._getAOP(obj, methodName);
64
65      if (AOP) {
66        delete obj._yuiaop[methodName];
67      }
68
69      var proxy = function proxy() {
70        var args = arguments;
71        var context = obj;
72
73        if (proto) {
74          context = this;
75        }
76
77        if (modules.length == 1) {
78          if (modules[0] in usedModules) {
79            Dependency._replaceMethod(obj, methodName, methodFn, context);
80
81            methodFn.apply(context, args);
82            return;
83          }
84        }
85
86        var firstLoad = false;
87        var queue = Dependency._proxyLoaders[guid];
88
89        if (!queue) {
90          firstLoad = true;
91          Dependency._proxyLoaders[guid] = new A.Queue();
92          queue = Dependency._proxyLoaders[guid];
93        }
94
95        queue.add(args);
96
97        if (firstLoad) {
98          modules.push(A.bind(Dependency._proxy, Liferay, obj, methodName, methodFn, context, guid, modules));
99          A.use.apply(A, modules);
100        }
101      };
102
103      proxy.toString = function () {
104        return methodFn.toString();
105      };
106
107      obj[methodName] = proxy;
108    }
109  };
110  Liferay.Dependency = Dependency;
111  Liferay.provide = Dependency.provide;
112})();
113//# sourceMappingURL=dependency.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.