Skip to content

Commit

Permalink
Removed argument wrapper for an event init
Browse files Browse the repository at this point in the history
- updated the package version to `0.3.4`
- updated an example inside the section `Accessing the wrapper in the JavaScript` in README
  • Loading branch information
tg666 committed Jan 5, 2022
1 parent be1ab9a commit 3a212f6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.4] - 2021-01-05

### Removed

- Removed argument `wrapper` for an event `init`. Callbacks for the event now have no arguments now, please use directly `CookieConsentWrapper` inside a callback function.

## [0.3.3] - 2021-01-05

### Changed
Expand Down Expand Up @@ -174,7 +180,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The first version of the package has been released.

[unreleased]: https://github.com/68publishers/cookie-consent/compare/v0.3.3...main
[unreleased]: https://github.com/68publishers/cookie-consent/compare/v0.3.4...main
[0.3.4]: https://github.com/68publishers/cookie-consent/compare/v0.3.3...v0.3.4
[0.3.3]: https://github.com/68publishers/cookie-consent/compare/v0.3.2...v0.3.3
[0.3.2]: https://github.com/68publishers/cookie-consent/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/68publishers/cookie-consent/compare/v0.3.0...v0.3.1
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ The only currently available event is `init`. A callback is invoked when the wra

```html
<script>
CookieConsentWrapper.on('init', function (wrapper) {
if (wrapper.allowedCategory('analytics_storage')) {
CookieConsentWrapper.on('init', function () {
if (CookieConsentWrapper.allowedCategory('analytics_storage')) {
// check if the analytics_storage is granted
}
wrapper.unwrap(); // get the original cookie consent plugin
CookieConsentWrapper.unwrap(); // get the original cookie consent plugin
});
</script>
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "68publishers-cookie-consent",
"version": "0.3.3",
"version": "0.3.4",
"description": "Cookie consent wrapper based on orestbida/cookieconsent with GTM integration.",
"homepage": "http://www.68publishers.io/",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/CookieConsentWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class CookieConsentWrapper {

on(event, callback, scope = null) {
if (Events.ON_INIT === event && this._initialized && null !== this._cookieConsent) {
callback.call(scope, this);
callback.call(scope);

return function () {};
}
Expand Down Expand Up @@ -143,7 +143,7 @@ class CookieConsentWrapper {
modalTriggerElements.textElement.innerHTML = self._dictionary.translate(self._cookieConsent.getConfig('current_lang'), 'modal_trigger_title');
}

self._eventBus.dispatch(Events.ON_INIT, self);
self._eventBus.dispatch(Events.ON_INIT);
};

if ('complete' === document.readyState) {
Expand Down

0 comments on commit 3a212f6

Please sign in to comment.