Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed Nov 6, 2024
1 parent 8a1068e commit 88d263e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion libs/features/mas/commerce/checkout-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ For each event except `click`, the following css classes are toggled on the elem
eventsDemo.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
logger('checkout link is clicked: ', e.target.href);
if (e.target.isCheckoutLink) {
logger('checkout link is clicked: ', e.target.href);
} else {
logger('element clicked: ', e.target);
}
});
document.getElementById('btnRefresh').addEventListener('click', () => {
[...eventsDemo.querySelectorAll('a')].forEach((a) =>
Expand Down
6 changes: 5 additions & 1 deletion libs/features/mas/docs/checkout-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ <h3 id="example-2" tabindex="-1">Example <a class="header-anchor" href="#example
eventsDemo.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&#x27;click&#x27;</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
e.<span class="hljs-title function_">preventDefault</span>();
e.<span class="hljs-title function_">stopPropagation</span>();
<span class="hljs-title function_">logger</span>(<span class="hljs-string">&#x27;checkout link is clicked: &#x27;</span>, e.<span class="hljs-property">target</span>.<span class="hljs-property">href</span>);
<span class="hljs-keyword">if</span> (e.<span class="hljs-property">target</span>.<span class="hljs-property">isCheckoutLink</span>) {
<span class="hljs-title function_">logger</span>(<span class="hljs-string">&#x27;checkout link is clicked: &#x27;</span>, e.<span class="hljs-property">target</span>.<span class="hljs-property">href</span>);
} <span class="hljs-keyword">else</span> {
<span class="hljs-title function_">logger</span>(<span class="hljs-string">&#x27;element clicked: &#x27;</span>, e.<span class="hljs-property">target</span>);
}
});
<span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&#x27;btnRefresh&#x27;</span>).<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&#x27;click&#x27;</span>, <span class="hljs-function">() =&gt;</span> {
[...eventsDemo.<span class="hljs-title function_">querySelectorAll</span>(<span class="hljs-string">&#x27;a&#x27;</span>)].<span class="hljs-title function_">forEach</span>(<span class="hljs-function">(<span class="hljs-params">a</span>) =&gt;</span>
Expand Down

0 comments on commit 88d263e

Please sign in to comment.