sirxemic / jquery.ripples

Add a water ripple effect to your background using WebGL.
https://sirxemic.github.io/jquery.ripples/
MIT License
1.06k stars 417 forks source link

Return from instantiation instead of throwing new error #58

Closed alexfigliolia closed 5 years ago

alexfigliolia commented 5 years ago

This solves my recently filed issue. Im not sure why, but all of a sudden throwing that error was stopping the flow of my website as opposed to gracefully failing like it used to. Cheers

sirxemic commented 5 years ago

If the error stops the flow, then you could also just have wrapped the initialization in a try-catch block. E.g.:

try {
  $('.some-element').ripples();
} catch (e) {
  // ripples failed to load
}

I think something can be said about not throwing an error, but there has to be an elegant way to figure out whether the plugin initialized or not. This PR does not offer that, so I'll have to reject it.

Also, just a tip for when you contribute to an open source project: don't make built files part of the PR. For this specific repository that would mean the PR should only contain modifications in src/main.js.