particles.js
particles.js copied to clipboard
Add ability for user to load a config as JS object OR file path
Re-opening #139 with dev base.
In the current state of particles.js, a user can only supply a config via loading a file path to a .json file. This works fine in some scenarios, but for example in my case, where I am updating config variables on the go based on user selected variables, I needed a way to pass my dynamic config without having to write to, update and parse a .json file over an over again which is slow and taxing.
This simple PR, which only adds a few lines of code on the load method simply checks if the config being passed is an Object or file path then handles appropriately. All existing functionality remains.
Note: All extra deletions in this commit simply remove empty spaces.
Can we support this?
Seems like this library isn't being actively maintained anymore. :( Feel free to just copy my code via the commit.
@tjhillard I did, but can not install it. Webpack says that can not found the module :/ Any idea?
It must be an integration issue or (less likely) a compatibility issue with webpack and this lib.
I will figure it out, thanks for the code!
Cheers!
+
window.particlesJS(tag_id, params);
(For anyone still using this library)