Skip to content

Commit

Permalink
chore: remove events bridge
Browse files Browse the repository at this point in the history
Remove the custome events bridge and use the grid's div as one
  • Loading branch information
hyyan committed May 26, 2020
1 parent c961448 commit 47bf427
Show file tree
Hide file tree
Showing 6 changed files with 28,011 additions and 52 deletions.
27,502 changes: 27,497 additions & 5 deletions client/dist/bbj-grid-widget.js

Large diffs are not rendered by default.

495 changes: 492 additions & 3 deletions client/dist/bbj-grid-widget.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/dist/report.html

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
</head>

<body>
<div
id="event-bridge-__id__"
onClick="window.basisDispatchCustomEvent(this, event.payload)"
></div>

<div tabindex="-1" id="__id__" style="height: 100%" class="__THEME__"></div>
</body>
</html>
10 changes: 2 additions & 8 deletions client/src/events/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export function gw_debounce(func, wait, immediate) {
/**
* Send an event to BBj side
*
* The function will trigger a custom click event on the `event-bridge-${id}` div
* then the div will use basisDispatchCustomEvent to dispatch the event to BBj
*
* @param {Array} context the grid's context
* @param {*} payload the event payload
* @param {String} eventId the event's id
Expand All @@ -44,11 +41,8 @@ export function gw_sendEvent(context, payload = {}, eventId = []) {
const registeredInterests = context.interests || []

if (registeredInterests.includes(eventId)) {
const div = gw_getDocument().getElementById(`event-bridge-${context.id}`)
const event = new CustomEvent('click')

event.payload = payload
div.dispatchEvent(event)
const div = gw_getDocument().getElementById(`${context.id}`)
window.basisDispatchCustomEvent(div, payload)
}
}

Expand Down
47 changes: 18 additions & 29 deletions demo/assets/templates/grid-template-with-font-awesome.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
<!DOCTYPE html>
<html lang="__lang__">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"/>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
</style>
</head>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"/>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
</style>
</head>

<body>
<div
id="event-bridge-__id__"
onClick="window.basisDispatchCustomEvent(this, event.payload)">
</div>

<div
id="__id__"
style="height: 100%"
class="__THEME__">
</div>
</body>

</html>
<body>
<div tabindex="-1" id="__id__" style="height: 100%" class="__THEME__"></div>
</body>
</html>

0 comments on commit 47bf427

Please sign in to comment.