Permalink
Browse files

docs(js): warn devs that that elgg_define_js() configuration is cached

Fixes #9302
  • Loading branch information...
mrclay committed Jan 11, 2016
1 parent f971429 commit a078c030346e5d67aba216631f44a788c0b273cb
Showing with 5 additions and 0 deletions.
  1. +2 −0 docs/guides/javascript.rst
  2. +3 −0 engine/lib/elgglib.php
@@ -190,6 +190,8 @@ Some things to note
global objects. Use modules.
#. Return the value of the module instead of adding to a global variable.
#. Static (.js,.css,etc.) files are automatically minified and cached by Elgg's simplecache system.
+#. The configuration is also cached in simplecache, and should not rely on user-specific values
+ like ``get_language()``.
Migrating JS from Elgg 1.8 to AMD / 1.9
View
@@ -158,6 +158,9 @@ function elgg_register_js($name, $url, $location = 'head', $priority = null) {
* Calling this function is not needed if your JS are in views named like `module/name.js`
* Instead, simply call elgg_require_js("module/name").
*
+ * @note The configuration is cached in simplecache, so logic should not depend on user-
+ * specific values like get_language().
+ *
* @param string $name The module name
* @param array $config An array like the following:
* array 'deps' An array of AMD module dependencies

0 comments on commit a078c03

Please sign in to comment.