-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
meteor package #50
Comments
Hi @newswim, of course! I'll add the command line in the ReadMe 👍 |
Hello @VincentGarreau, I've asked for this library to be folded into @dandv 's autopublish.meteor service, in the mean time I've published the package to https://atmospherejs.com/newswim/particles and will be submitting PR later today. here's my fork: https://github.com/newswim/particles.js |
Hey @newswim, I was using your smart package and encountered this error: Uncaught TypeError: Cannot read property 'appendChild' of null It appears to be originating from |
Hi @2014mchidamb --- I will look at this in more detail, but in the mean time make sure your code is wrapped in Meteor.isClient -> Meteor.startup object, like this:
Also there is a lot of contention and work being put into the package build system for Meteor involving curling upstream sister repos into the package, it's not completed yet but you can look at the examples users 'dandv' and 'splendido' have made. When this is perfected I will rebuild the package. |
I can't really take much credit for autopublish. @splendido did all the excellent work! |
@newswim, thank you very much - my code is wrapped as you have described (this is a test, so my js file is virtually identical to the one in your demo). Weirdly, I have gotten the package to work with other apps - but unfortunately not the one I am currently working on. The relevant HTML file looks as follows:
|
@2014mchidamb, Maybe run your js through a linter just to check everything? Are there any errors being thrown? Particles.js will create a element inside of and taking up the entire area of the containing div (this can also be changed to target |
@newswim, there appear to be no errors other than the aforementioned Uncaught TypeError. I'm using the materializecss package in this project, is it possible that there is something in that package blocking the div? Is there any way to check/debug that? |
@2014mchidamb, this may be due to the div being inside a template, and the div not being loaded yet when the handler is called. Have you gotten any further with debugging? |
@newswim, I got it to work by putting the particles code in my home template's js file. Thanks for the help! |
@newswim, Actually, it looks like the particles don't load if I navigate back to the home page with the back button. However, they load after I reload the page. Would you happen to know why this is happening? Shouldn't Meteor.startup prevent this? |
@2014mchidamb Meteor.startup just ensures that the code is executed at runtime. I have a feeling that that .startup isn't the proper wrapper for this type of static api. We need the code to rerun any time the template is rendered, but it isn't exactly a reactive template, even though there (can be/are) nodes being pushed to the particles-js object. We need a helper that says, |
any news on this @newswim? Interested to hear how you solved this.. |
I spent a bit of time yesterday upgrading to 2.0.0, but I still need to
work out the best way to reference a json file for settings. Typing a
command every time won't fly. I'll put aside time this week to find a
solution.
|
@newswim, lets try to figure out whether we'd like @VincentGarreau to merge the necessary files to officially support Meteor or simply wrap the package like we're doing for other libraries (see, e.g., jspdf-core-wrapper. The best, off course, would be @VincentGarreau to accept a PR! :-) |
Any update on this? currently the meteor package doesn't play nicely with the generator |
For anyone having issues with
and provide any element id that you wish the canvas to be appended to. If you have questions just ask and I'd be happy to help. |
@noncototient I'm trying to add particles.js to a meteor app via kadira:dochead, and I'm getting such an error: |
hey @you-fail-me So I had originally made a Meteor smart package for an older version of particles.js, and then tried upgrading when Vincent changed the configuration, but ended up breaking everything.. so that's why adding the meteor package (afaik) does not work. I really need to fix this. But since you're loading from a CDN, that's not the issue, however my feeling is that dochead isn't available when your initialization code is being ran. This is probably an artifact of Meteor's eager file loading order. Can you post the dochead snippet? |
@newswim Thank you, already fixed it. If it might help someone some day - the issue was in load order, particles.js initialization was called before the dom with the target id was built. Just needed to check that the script is loaded and the dom is built at the moment of initializing particles.js. |
Sweet! Can I ask if you are using a json file or passing an object to particlesJS? |
@newswim I'm using a json file, stored where all the assets are |
Cool - I just got it working similarly, but I had to edit one line in particles.js (1517). window.pJSDom.push(new pJS(tag_id, params));
// rather than
// pJSDom.push(new pJS(tag_id, params)); This is probably specific to Meteor, so if anyone wants to keep using the package, I will update it with this change and provide instructions. I could see the reassignment not being necessary if you were loading particles over cdn. Also: I disabled click events and ensured the canvas wouldn't push anything out of the way, like so: #particles-js {
position: absolute;
pointer-events: none;
} |
I was afraid that I would be forced to do smth like this (things like you have to explicitly add |
update I've published a new version of the package, if anyone wants to test, please let me know if anything gives you trouble. https://atmospherejs.com/newswim/particles cheers :] |
is it okay if I make a smart package of this library for the Meteor framework?
The text was updated successfully, but these errors were encountered: