-
Notifications
You must be signed in to change notification settings - Fork 116
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
Namespace issue #170
Comments
Sorry about that. Not sure why that's happening when those variables shouldn't be exposed to the global scope. I'm happy to accept an update for this. Do you want to submit a pull request with the necessary changes? Please just read the guidelines before submitting. |
Will do, how do you want it Namespaced? I did Restivus.Route for ease but anything would work really. |
Hmmm. Good question. I don't want to expose it outside the package if I can avoid it. |
See https://github.com/Kestanous/meteor-restivus if you want to see what I did, still reviewing your guidelines so it may need some work. |
After some thought I think it may be a coffeescript issue. I think package top level this "@" is actually app global. I recall having an issue with this a long time ago. I believe that is one of the reasons I now only write packages in js vs coffee, and keep coffee for apps only. |
I was just looking into that. I think you're correct. But the meteor docs suggest there may be some fixes easier than converting the entire package to js. From the meteor docs on CoffeeScript:
They've been claiming that feature to be experimental for over a year now, and they still haven't removed it from the docs, so folks must have not complained about it being broken. We could try that as well. I think I prefer the first option though. Not a huge fan of having this random |
Hmm yeah, I will give the first a shot. It would be nice to solve this. |
Awesome. Keep me posted. Thanks for following up on this! |
So as far as I can tell option one does not work, we would have to define the classes in the package-scope-variables.js file. Which we can't do if you want to use Coffeescript classes. Defining the class as one of those vars in another file is still file scoped, Option two could work as an alternative but at that point it is the same as my solution (and I think mine is cleaner). At this stage I need to ask why. Why don't you want the |
|
Fair point, though IMO an object is an object. We could use the magic shard object instead. It is semantics really, so whatever your comfortable with. One thing to note is your tests prove Route is on the Global scope as they can access it directly. If we fix this you are going to need a way for your tests to find that object. I proved that when testing option one. I think we can add the |
The other option is to introduce another "namespace" that will behave exactly like Route does now, and may interfere in other projects that are currently using Restivus. So I'd rather work with the |
I just published v0.8.5 with the fix for this. Let me know if you have any issues with that. |
Thank you, sorry lost track of this. We are in production now with my quick fix so it may be a while before I get to testing this in the wild. |
I have a collection named "Route". After a lot of debugging "TypeError: object is not a function" I realized my collection was being used by Restivus in place of its internal Route class. I already check, your not exporting Route and it is not available in global scope. Yet by changing three lines of your code I made "Route" -> "Restivus.Route". This fixed my issue, likely a global scope problem.
I can continue to consume your package locally, version locked to 0.8.3, but wondered if you had any suggestions.
The text was updated successfully, but these errors were encountered: