Permalink
Browse files

feature(js): Allow canceling a previous elgg_require_js() call

Fixes #9074
  • Loading branch information...
mrclay committed Oct 26, 2015
1 parent 017b787 commit 375be5ffddfb9dc598d3d15bf1d6069f2eb88c8c
Showing with 13 additions and 0 deletions.
  1. +1 −0 engine/classes/Elgg/Amd/Config.php
  2. +12 −0 engine/lib/elgglib.php
@@ -91,6 +91,7 @@ public function removePath($name, $path = null) {
* deps: array Dependencies
* exports: string Name of the shimmed module to export
* @return void
+ * @throws \InvalidParameterException
*/
public function addShim($name, array $config) {
$deps = elgg_extract('deps', $config, array());
View
@@ -219,6 +219,18 @@ function elgg_require_js($name) {
_elgg_services()->amdConfig->addDependency($name);
}
+/**
+ * Cancel a request to load an AMD module onto the page.
+ *
+ * @note The elgg, jquery, and jquery-ui modules cannot be cancelled.
+ *
+ * @param string $name The AMD module name.
+ * @return void
+ * @since 2.1.0
+ */
+function elgg_unrequire_js($name) {
+ _elgg_services()->amdConfig->removeDependency($name);
+}
/**
* Get the JavaScript URLs that are loaded

0 comments on commit 375be5f

Please sign in to comment.