New widget-setup utility function, hideWhenNarrow.
[mkws-moved-to-github.git] / src / mkws-widget.js
index a16dec1..faee22d 100644 (file)
@@ -116,3 +116,14 @@ widget.autosearch = function(widget) {
 };
 
 
+// Utility function for all widgets that want to hide in narrow windows
+widget.hideWhenNarrow = function(widget) {
+    widget.team.queue("resize-narrow").subscribe(function(n) {
+       $(widget.node).hide();
+    });
+    widget.team.queue("resize-wide").subscribe(function(n) {
+       $(widget.node).show();
+    });
+};
+
+