Skip to content

static members forwarding #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eddow opened this issue Aug 28, 2017 · 2 comments
Closed

static members forwarding #135

eddow opened this issue Aug 28, 2017 · 2 comments

Comments

@eddow
Copy link
Contributor

eddow commented Aug 28, 2017

Would it be possible to forward static members of a class ?

@Component
class myComponent {
  static myValue = 42
}

//For now, myComponent.myValue -> undefined
@dagatsoin
Copy link

dagatsoin commented Sep 13, 2017

I just have a case where using JSS with a theme stored in Vuex is not possible.

In my case I need to compile a theme at the first instantiation of a component and save it in a static member for the futur instantiations. But as the Component decorator eats static function, this does not work.

@Component({
  mixins: jss
})
export default class Badge extends Vue {
        themeCompiler: Function = badge;

        static styleSheet: Object;

        get classes(): Object | null {
            if (!Badge.styleSheet) {
                Badge.styleSheet = jss.createStyleSheet(this.themeCompiler(this.jss.theme)); // jss is injected
                Badge.styleSheet.attach();
                return Badge.styleSheet.classes as Object; // does not work, styleSheet === undefined
            } else return null;
        }
    }

@ktsn
Copy link
Member

ktsn commented Oct 26, 2017

merged #146

@ktsn ktsn closed this as completed Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants