Optimization when block not relevant

This commit is contained in:
PMKuipers 2023-08-18 19:29:56 +02:00
parent 6a5de18359
commit a669e34796
2 changed files with 57 additions and 56 deletions

View File

@ -43,9 +43,10 @@ let strings = load_strings({
* @param {Object} arg Arguments passed * @param {Object} arg Arguments passed
*/ */
export function init(type="myreport",arg) { export function init(type="myreport",arg) {
// Make sure on window resize, the line wrappers are repositioned, to fix scrolling issues // Save time by only starting up the Vue app if the required block element is present
window.addEventListener('resize',fixLineWrappers); const blockelement = document.getElementById('block_mytreestudyplan');
let app = new Vue({ if(blockelement){
const app = new Vue({
el: '#block_mytreestudyplan', el: '#block_mytreestudyplan',
data: { data: {
"studyplans": [], "studyplans": [],
@ -100,7 +101,7 @@ let strings = load_strings({
}, },
}); });
}
} }

View File

@ -1,6 +1,6 @@
<?php <?php
$plugin->component = 'block_mytreestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494) $plugin->component = 'block_mytreestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
$plugin->version = 2023081600; // YYYYMMDDHH (year, month, day, iteration) $plugin->version = 2023081800; // YYYYMMDDHH (year, month, day, iteration)
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11) $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11)
$plugin->dependencies = [ $plugin->dependencies = [