FokkeZB / nl.fokkezb.loading

The widget provides a simple loading mask that can be easily styled and configured.
93 stars 18 forks source link

Use view instead of window as view as root element #20

Closed iskugor closed 9 years ago

iskugor commented 10 years ago

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?

guiled commented 10 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...

iskugor commented 10 years ago

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");

FokkeZB commented 10 years ago

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.

FokkeZB commented 9 years ago

Added in 1.8