diff --git a/examples/ThemeProvider.html b/examples/ThemeProvider.html
new file mode 100644
index 000000000..7848ee406
--- /dev/null
+++ b/examples/ThemeProvider.html
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/base/context.js b/src/base/context.js
index 67ef704c0..f799812c8 100644
--- a/src/base/context.js
+++ b/src/base/context.js
@@ -15,7 +15,10 @@ BI.Context = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
- this.context = BI.createWidget(o.items[0] || o.el, {
+ if (o.context) {
+ this.$context = BI.useContext(o.context);
+ }
+ this.context = BI.createWidget((o.items[0] || o.el)(this.$context), {
element: this,
});
this.context.on(BI.Controller.EVENT_CHANGE, function () {
@@ -23,11 +26,10 @@ BI.Context = BI.inherit(BI.Widget, {
});
},
- created: function () {
+ __initWatch: function () {
+ BI.Context.superclass.__initWatch.call(this);
var o = this.options;
- if (o.context) {
- BI.watch(o.context, o.watch);
- }
+ BI.watch(this.$context, o.context, o.watch);
},
setValue: function (v) {