forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a form of static:require_module that assumes that the factory is …
…self-initializing
- Loading branch information
1 parent
7858066
commit bacd433
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
define([], function() { | ||
'use strict'; | ||
|
||
return function invokePageFactory(name, factory) { | ||
var args; | ||
|
||
if (typeof window.pageFactoryArguments === 'undefined') { | ||
throw Error( | ||
'window.pageFactoryArguments must be initialized before calling invokePageFactory(' + | ||
name + | ||
'). Use the <%static:require_page> template tag.' | ||
); | ||
} | ||
args = window.pageFactoryArguments[name]; | ||
|
||
if (typeof args === 'undefined') { | ||
throw Error( | ||
'window.pageFactoryArguments["' + | ||
name + | ||
'"] must be initialized before calling invokePageFactory(' + | ||
name + | ||
'). Use the <%static:require_page> template tag.' | ||
); | ||
} | ||
factory.apply(null, window.pageFactoryArguments[name]); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters