Skip to content
Browse files

add hooks to patch both the pre/post initialized instance

  • Loading branch information...
1 parent f3997c6 commit 5b09c9ceb1088f1fb1e7b599a99da241fa0f1481 @ekashida committed
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/yui/js/yui.js
View
20 src/yui/js/yui.js
@@ -66,6 +66,16 @@ available.
},
gconf = (typeof YUI_config !== 'undefined') && YUI_config;
+ // Early hook to patch YUI instance
+ if (!Y._instancePatched && gconf && gconf.instancePatches) {
+ (function (patches, len, i) {
+ Y._instancePatched = true;
+ for (i = 0, len = patches.length; i < len; i += 0) {
+ patches[i](Y);
+ }
+ }(gconf.instancePatches));
+ }
+
if (!(instanceOf(Y, YUI))) {
Y = new YUI();
} else {
@@ -150,6 +160,16 @@ available.
Y.instanceOf = instanceOf;
+ // Hook to patch intialized instance
+ if (!Y._patched && Y.config.patches) {
+ (function (patches, len, i) {
+ Y._patched = true;
+ for (i = 0, len = patches.length; i < len; i += 0) {
+ patches[i](Y);
+ }
+ }(Y.config.patches));
+ }
+
return Y;
};

0 comments on commit 5b09c9c

Please sign in to comment.
Something went wrong with that request. Please try again.