Sha256: 8c231ec16040458526b1c55acea90cb2aeadf93e0a6a9c06723ebf4d3ba4a7fb
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
// This is used to get a proper binding of the actionData // https://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example import {VBaseContainer} from "./base-container"; import {hookupComponents} from "./base-component"; import {MDCTextField} from "@material/textfield"; import {VDateTime} from "./datetime"; export function initDialogs() { console.log('\tDialogs'); hookupComponents('.v-dialog', VDialog, null); } function createDialogHandler(dialog) { return function () { dialog.close(); }; } export class VDialog extends VBaseContainer { constructor(element) { super(element); let dialog = element; var dialogButtons = dialog.querySelectorAll('button:not([disabled])'); for (var j = 0; j != dialogButtons.length; j++) { var dialogButton = dialogButtons[j]; if (!dialogButton.dialog) { dialogButton.dialog = dialog; var buttonEvents = dialogButton.dataset.events; // If the dialog button does not have any events tied to it, // then close the dialog on click, otherwise let the events handlers // take care of the close. if (!buttonEvents) { dialogButton.addEventListener('click', createDialogHandler(dialog)); } } } } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
voom-presenters-0.2.0 | views/mdc/assets/js/components/dialogs.js |