Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Adobe Data Layer | Examples</title>
<script>adobeDataLayer = [];</script>
<script src="../dist/adobe-client-data-layer.min.js" async></script>
<script src="js/datalayer.mocks.1.js" defer></script>
<script src="js/datalayer.mocks.1.js"></script>
</head>
<body>
<h1>Adobe Client Data Layer | Examples</h1>
Expand Down
52 changes: 52 additions & 0 deletions examples/js/datalayer.mocks.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
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 = past -> console output should be: event1, event2

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

var myHandler = function(event) {
console.log(event.event);
};

adobeDataLayer.push({
event: "event1"
});

adobeDataLayer.push(function(dl) {
dl.push({
event: "event2"
});

dl.addEventListener(
"adobeDataLayer:event",
myHandler,
{"scope": "past"}
);

dl.push({
event: "event3"
});

});

adobeDataLayer.push({
event: "event4"
});

})();
52 changes: 52 additions & 0 deletions examples/js/datalayer.mocks.3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
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 || [];

var myHandler = function(event) {
console.log(event.event);
};

adobeDataLayer.push({
event: "event1"
});

adobeDataLayer.push(function(dl) {
dl.push({
event: "event2"
});

dl.addEventListener(
"adobeDataLayer:event",
myHandler,
{"scope": "future"}
);

dl.push({
event: "event3"
});

});

adobeDataLayer.push({
event: "event4"
});

})();
Loading