-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10 - Early config reload support, added benefit of cleaning up Actio…
…nButton.js early state code
- Loading branch information
Showing
4 changed files
with
46 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
import './ActionButton.js' // To define action-button | ||
|
||
export function marshalActionButtonsJsonToHtml (json) { | ||
const currentIterationTimestamp = Date.now() | ||
|
||
for (const jsonButton of json.actions) { | ||
var htmlButton = document.querySelector('#actionButton_' + jsonButton.id) | ||
|
||
if (htmlButton == null) { | ||
htmlButton = document.createElement('button', { is: 'action-button' }) | ||
htmlButton.constructFromJson(jsonButton) | ||
|
||
document.getElementById('rootGroup').appendChild(htmlButton) | ||
} else { | ||
htmlButton.updateFromJson(jsonButton) | ||
htmlButton.updateHtml() | ||
} | ||
|
||
console.log("action", jsonButton.title) | ||
htmlButton.updateIterationTimestamp = currentIterationTimestamp; | ||
} | ||
|
||
for (const existingButton of document.querySelectorAll('button')) { | ||
if (existingButton.updateIterationTimestamp != currentIterationTimestamp) { | ||
existingButton.remove(); | ||
} | ||
} | ||
} |