Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Joncom

I'm making a module that looks something like this:
ig.module('game.event-manager')
.requires('impact.impact', 'game.event')
.defines(function(){
    ig.EventManager = ig.Class.extend({
        events: [],
        update: function() {
        }
    });
});

Technically speaking, ig.Class will always be available before this module is loaded, so it don&039;t really need to include #'impact.impact' for things to work.

However, ig.Class is defined in 'impact.impact' and is thus a dependency. Should I require it or not?

I think the answer is yes, but I just wanted to see if others had a different view on the matter...

1 decade ago by dominic

Well, as you said, requiring impact.impact would be a formality at most. It has no functional implications for your code.

Even from a semantic standpoint requiring it doesn&039;t really make that much sense, because if #impact.impact is not defined, neither is ig.module - meaning, that if impact.impact is not already loaded, you can't load it anyway.

Also, technically speaking, ig.Class is not defined in the impact.impact module; it&039;s defined in the #lib/impact/impact.js file, but the impact.impact module in that file only defines ig.main.

So, I would lean towards "no". Interesting question, though :)

1 decade ago by Joncom

Thanks for the insight. I think I will stop requiring impact.impact in these cases.
Page 1 of 1
« first « previous next › last »