stampit-org / stampit

OOP is better with stamps: Composable object factories.
https://stampit.js.org
MIT License
3.02k stars 102 forks source link

Suggestions on how to leverage stampit w/ Vue.js? #330

Closed gajewsk2 closed 6 years ago

gajewsk2 commented 6 years ago

I'm just starting to use stampit + riot.js and really enjoying the freedom both of these libraries offer. I'm wondering if anyone has any experience w/ stampit + Vue.js and how one would leverage stampit with Vue components?

koresar commented 6 years ago

Coincidently, I'm using stampit with Vue. :)

What exactly you want to leverage? Like, concrete thing you're looking to do.

gajewsk2 commented 6 years ago

Honestly, I'm wondering what a good entry point for stamps are, so nothing specific. I'm thinking I would be using Vue.component frequently and would need a good way to add more functionality to base level Vue instances. Vue seems to heavily use Vue.extend, which is the same as class inheritance, so do you manage to avoid that with the use of stampit?

Like I said, I'm more just curious how you or anyone has effectively utilized stamps + Vue.js. Do you happen to have any code samples or repos?

koresar commented 6 years ago

Stamps are a replacement of classes. Use stamps same way as you would use classes in Vue. ¯\_(ツ)_/¯

AFAIK Vue.extend extends (mutates) Vue, nothing related to inheritance. Inheritance in JS is one object linking to another.

In my Vue project we do not use Vue.extend at all.

So, probably I don't have the code samples as you expect. :) I'm using stamps instead of classes. That's it! :)

pendenaor commented 6 years ago

Did you use vuex store ? Is stamp can be mixed with it?

koresar commented 6 years ago

Anything can be put into the store. An object, a function, a class, a class instance, a stamp, a stamp instance, etc.

Anything can be put into a stamp. Including vuex store.

In your question you can freely replace the word "stamp" with "class" and answer yourself.

Did you use vuex store ? Is class can be mixed with it?

If you are looking for some design patterns of how I use vuex with stamps then unfortunately I don't do anything fancy. My stores contain object instances created from stamps.

davewallace commented 6 years ago

I'm about to jump into Vue and stampit, wish me luck, I like both concepts independently so let's see if they play well :)