Reputation: 1094
I have came from writing highly object orientated code to writing javascript so i find it weird how Meteor compiles all its javascript into one big javascript file.
My issue is that I have two JavaScript files, OpenIDService.js and SteamOpenIDService.js, SteamOpenIDService.js contains a class and so does OpenIDService.js. The SteamOpenIDService
class inherits from the OpenIDService class but to inherit from a different javascript file I need to include/import/require the other javascript file but I am lead to believe that Meteor does not support the 'require' function and instead it includes files in a certain order based of the folder structure which I find highly confusing.
A bit about the folder structure...
The file init.js references the SteamOpenIDService class.
How can I make meteor include/import/require OpenIDService
into the SteamOpenIDService file?
Upvotes: 1
Views: 109
Reputation: 10392
Meteor automatically imports files depth first, and in alphabetical order. Any variable that is global in your file will be exported.
If your SteamOpenIdService inherits from the OpenIDService, then their current names should work.
You'll need to make sure that OpenIDService is global (ie, no var
before it).
See this answer for details on the load order.
Upvotes: 2