-
Notifications
You must be signed in to change notification settings - Fork 367
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
feature: allow user to disable alerts #280
Comments
You can disable alerts by setting |
Thanks. Works. |
I may have spoken too soon. Even with this: var rangy = require('rangy')
rangy.config.alertOnFail = false I still can see alerts. Is there a way we can pass the config directly into the module? |
This is controversial. Currently, passing a configuration by using `rangy.config.alertOnFail = false` after `require('rangy')` does not work in all environments, I believe because it is async and it isn't able to access the function as it is wrapped in an IIFE. In order to fix this, when rangy is initialized, the config has to be loaded in immediately. This isn't possible with the current syntax, as you can't load in parameters. After a lot of fiddling around, the best I could come up with was this solution. However, it is a breaking change - all implementations using require and CommonJS will have to use this syntax: ```js var rangy = require('rangy')() ``` To set a config, you would do this: ```js var rangy = require('rangy')({'alertOnFail': true}) ``` I couldn't find a way around this. This solution works for me, closes timdown#280.
I've set the default for that option to |
Thanks @timdown. Can you bump the version for npm? |
I'm planning to do another beta release at the weekend once I've fixed a few bugs. Can you wait until then? |
Not a problem. Thanks. — On Wed, Mar 18, 2015 at 5:20 PM, Tim Down notifications@github.com
|
I've got rangy working in a browserified chrome extension. The extension is always on, and every now and then, rangy does not work in the environment. This happens every time I open a new tab from a Google search link, for instance. In such cases, it throws an alert, although I'm not using rangy at that moment and it is just alerting from the Chrome extension.
Is there a way I can require rangy without enabling alerts? I'd rather the user never see them, or just console.log them.
The text was updated successfully, but these errors were encountered: