Merge pull request #489 from smysnk/master
Add AMD support to keycloak javascript adapter
This commit is contained in:
commit
3cf52b018c
1 changed files with 659 additions and 633 deletions
|
@ -1,4 +1,6 @@
|
||||||
var Keycloak = function (config) {
|
(function( window, undefined ) {
|
||||||
|
|
||||||
|
var Keycloak = function (config) {
|
||||||
if (!(this instanceof Keycloak)) {
|
if (!(this instanceof Keycloak)) {
|
||||||
return new Keycloak(config);
|
return new Keycloak(config);
|
||||||
}
|
}
|
||||||
|
@ -740,4 +742,28 @@ var Keycloak = function (config) {
|
||||||
"country",
|
"country",
|
||||||
"claims_locales"
|
"claims_locales"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
|
||||||
|
// Expose KeyCloak as module.exports in loaders that implement the Node
|
||||||
|
// module pattern (including browserify). Do not create the global, since
|
||||||
|
// the user will be storing it themselves locally, and globals are frowned
|
||||||
|
// upon in the Node module world.
|
||||||
|
module.exports = Keycloak;
|
||||||
|
} else {
|
||||||
|
// Otherwise expose KeyCloak to the global object as usual
|
||||||
|
window.Keycloak = Keycloak;
|
||||||
|
|
||||||
|
// Register as a named AMD module, since KeyCloak can be concatenated with other
|
||||||
|
// files that may use define, but not via a proper concatenation script that
|
||||||
|
// understands anonymous AMD modules. A named AMD is safest and most robust
|
||||||
|
// way to register. Lowercase jquery is used because AMD module names are
|
||||||
|
// derived from file names, and KeyCloak is normally delivered in a lowercase
|
||||||
|
// file name. Do this after creating the global so that if an AMD module wants
|
||||||
|
// to call noConflict to hide this version of KeyCloak, it will work.
|
||||||
|
if ( typeof define === "function" && define.amd ) {
|
||||||
|
define( "keycloak", [], function () { return Keycloak; } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})( window );
|
Loading…
Reference in a new issue