You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by dd...@apache.org on 2012/09/05 16:46:25 UTC
svn commit: r1381205 -
/shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js
Author: ddumont
Date: Wed Sep 5 14:46:25 2012
New Revision: 1381205
URL: http://svn.apache.org/viewvc?rev=1381205&view=rev
Log:
oauthpopup - delay checking for container code till it's defined.
Modified:
shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js
Modified: shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js?rev=1381205&r1=1381204&r2=1381205&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js (original)
+++ shindig/trunk/features/src/main/javascript/features/oauthpopup/container_oauthpopup.js Wed Sep 5 14:46:25 2012
@@ -110,17 +110,21 @@
};
// Support mixing into the container which makes js rpc tests super easy.
- if (osapi && osapi.container && osapi.container.Container && osapi.container.Container.addMixin) {
- osapi.container.Container.addMixin('oauth', function(container) {
+ // To override this mixin, you'll need to setTimeout, because we need to do the same here.
+ // This feature doesn't depend on `container` so it probably won't get defined before us.
+ setTimeout(function() {
+ if (osapi && osapi.container && osapi.container.Container && osapi.container.Container.addMixin) {
+ osapi.container.Container.addMixin('oauth', function(container) {
+ gadgets.rpc.register('oauth.open', function(location, options) {
+ container.oauth.open(location, options, this.f, this.callback);
+ });
+
+ return oauth;
+ });
+ } else {
gadgets.rpc.register('oauth.open', function(location, options) {
- container.oauth.open(location, options, this.f, this.callback);
+ oauth.open(location, options, this.f, this.callback);
});
-
- return oauth;
- });
- } else {
- gadgets.rpc.register('oauth.open', function(location, options) {
- oauth.open(location, options, this.f, this.callback);
- });
- }
+ }
+ }, 0);
})();
\ No newline at end of file