Closed iskugor closed 9 years ago
I DO use the widget as a window and it is very easy to display the fullscreen loader wherever I code it (module, controller, widget). I agree with this suggestion only if there is a solution as simple as the current one (I don't want to add the "widget" in every view I use...
I'm not sure do I understand what's the problem, but if you would want to use widget old way, you could create your own widget that has Window as root element and then just Require loading widget as a child. Here is small example of how to do it.
// widget.xml
<Window id="win">
<Require type="widget" src="nl.fokkezb.loading" id="loading" />
</Window>
and ...
//widget.js
exports.show = function(message) {
$.loading.show(message);
$.win.open();
};
exports.hide = function() {
$.win.close();
};
And then in alloy.js
Alloy.Globals.loading = Alloy.createWidget("my.widget.loading");
Just as a note, I do see your discussion and I'll work at it when I'm less busy. I'll probably introduce a new controller called view
which will be required by window
but can also be used stand-alone.
Added in 1.8
Hi Fokke.
Would you consider using view instead of window as view as root element?
I think widget would be more flexible that way because:
Basically, that way you can add widget wherever you want (not always we want loading to take whole screen).
People that want use is it with window - it would be easy to transition, they can just make new widget that will have window root element and add loading widget to it.
What do you think?