Skip to content

Commit

Permalink
@releng - prepare release 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszglow committed Oct 29, 2020
1 parent beecbf0 commit f68db55
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 3 deletions.
92 changes: 92 additions & 0 deletions examples/js/datalayer.mocks.4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
/* global console, window, dataLayer, CustomEvent */
(function() {
'use strict';

/* eslint no-console: "off" */
/* eslint no-unused-vars: "off" */

// Test case: scope = future -> console output should be: event3, event4

window.adobeDataLayer = window.adobeDataLayer || [];



// Example 1. If event listener has path filter then we return before / after value not the whole before / after state

adobeDataLayer.addEventListener("test1", function(event, before, after) {
console.log('LOG1: ', before, after);
}, { path: 'component.image' });
adobeDataLayer.push({
event: "test1",
component: { image: { id: 'image1' } }
});
// LOG1: undefined, { id: "image1' }

// Clear DL before next example
adobeDataLayer.push({ component: null });



// Example 2. If we add event listener and only then push items to DL we get before / after state arguments in callback function.

adobeDataLayer.addEventListener("test2", function(event, before, after) {
console.log('LOG2: ', before, after);
});
adobeDataLayer.push({
event: "test2",
count: "one"
});
// LOG2: {}, { count: "one" }

// Clear DL before next example
adobeDataLayer.push({ count: null });



// Example 3. If we add event listener then for all past items (items in DL) we will not get before / after arguments in callback function.

adobeDataLayer.push({
event: "test3",
count: "one"
});
adobeDataLayer.addEventListener("test3", function(event, before, after) {
console.log('LOG3: ', before, after);
});
// LOG3: undefined, undefined

// Clear DL before next example
adobeDataLayer.push({ count: null });



// Example 4. If we have data in DL, then add event listener and then push items to DL we will get before / after state arguments in callback function only for items that are pushed after event listener was added.

adobeDataLayer.push({
event: "test4",
count: "one"
});
adobeDataLayer.addEventListener("test4", function(event, before, after) {
console.log('LOG4: ', before, after);
});
adobeDataLayer.push({
event: "test4",
count: "two"
});
// LOG4: undefined, undefined
// LOG4: {}, { count: "one" }

// Clear DL before next example
adobeDataLayer.push({ count: null });

})();
2 changes: 1 addition & 1 deletion 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,7 +1,7 @@
{
"name": "@adobe/adobe-client-data-layer",
"description": "Adobe Client Data Layer",
"version": "1.1.1",
"version": "1.1.2",
"main": "dist/adobe-client-data-layer.min.js",
"license": "Apache-2.0",
"private": false,
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.1.1"
"version": "1.1.2"
}

0 comments on commit f68db55

Please sign in to comment.