enyo.scrim: Is it possible to add components?

edited February 2012 in Enyo 1.0
I would like to add a spinner to enyo.scrim (the singleton, not a enyo.Scrim kind), is that possible?

I could not figure out how to do this. I ended up adding my own Scrim kind (with a Spinner component in it) to the app components. This works for me, but as the docs stated that the usage in a components block is not common, i thought there should be another way to achieve this.

Any ideas? Thanks in advance.


  • I think you've taken the right approach. While I think it would be possible to add a spinner, it's not straightforward. enyo.scrim creates a new enyo.Scrim when you call show() but doesn't return that object.

    Here's a hack to do it but not one I'd recommend.
    // assuming scrim is first child ... probably isn't a safe assumption
    var scrim = enyo.getPopupLayer().children[0];
    scrim.createComponent({kind:"HFlexBox", pack:"center", align:"center", height:"100%", width:"100%", components:[{kind:"SpinnerLarge", name:"spinner"}]});
  • Thanks, i kind of expected that. Your solution works, but i think it's neither meant to do it that way. I'll stick with component in my app for now.
  • I found that it's easiest just to include the scrim in the components property:
    components: [
     {kind: "Scrim", layoutKind: "VFlexLayout", align: "center", pack: "center", components: [
      {kind: "SpinnerLarge"}
    ... the rest of your components ...
    and then hide and show the scrim with a method:
    // Pass true to show scrim, false to hide scrim
    showScrim: function(inShowing) {
Sign In or Register to comment.