Code Monkey home page Code Monkey logo

Comments (4)

bodograumann avatar bodograumann commented on August 23, 2024

I fail to see what the use case for this is. Maybe you can explain what you are trying to achieve.

We register the modules through store.registerModule (https://github.com/gertqin/vuex-class-modules/blob/master/src/module-factory.ts#L178) or store.hotUpdate (https://github.com/gertqin/vuex-class-modules/blob/master/src/module-factory.ts#L169).
In the former case it would be a simple to change to allow not only string names for the registration name, but also arrays of strings, which would lead to submodule registration.
In the latter case we probably need to build a structure for the parent modules. Not sure what we need to provide for them exactly.

from vuex-class-modules.

gertqin avatar gertqin commented on August 23, 2024

I agree with @bodograumann - I have also never had the need for submodules. Why can't it just be a another regular module?

from vuex-class-modules.

onkarj422 avatar onkarj422 commented on August 23, 2024

I agree with @bodograumann - I have also never had the need for submodules. Why can't it just be a another regular module?

Dynamic registration becomes pretty efficient when used along with nested modules.

Consider this example hierarchy in a particular domain -

- GlobalModule
    -UserModule
    -InputModule
        -OutputModule
            -ReportsModule

So here, the bottom most module ReportsModule is depended on OutputModule which in turn is depended on InputModule.
Now, in my components, the InputModule and the whole InputComponent view tree by which it is consumed will be dynamically registered and dynamically rendered based on some condition.
In this case, registering InputModule dynamically, will in turn make its nested modules also dynamic.

But, in a non-hierarchical structure,

- GlobalModule
- UserModule
- InputModule
- OutputModule
- ReportsModule

In this case, while registering InputModule based on some condition you will have to specify those other two modules Output & ReportsModule explicitly.

What do you guys think? @bodograumann @gertqin

from vuex-class-modules.

bodograumann avatar bodograumann commented on August 23, 2024

So basically you want to automatically load other modules when a “parent”-module is loaded into the store.

I guess that is not impossible to implement, but there doesn't seem to be any easy way of implementing it, that works with the rest of vuex-class-modules. It is probably not worth the effort.

Especially as you can quite easily implement it on your side. You will anyway have to register the module somehow.
const inputModule = new InputModule({ store, name: "user" });
So at that point you can also wrap it in a function and register the other modules.

function registerInputModule() {
    return {
        inputModule: new InputModule({ store, name: "user" }),
        outputModule: new OutputModule({ store, name: "user" }),
        reportModule: new ReportModule({ store, name: "user" }),
    }
}

from vuex-class-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.