How can I force page refresh from an Events API

How can I force page refresh from an Events API

by Paul McLennan -
Number of replies: 0
Usually activities with completion criteria update the next URL once the completion is met, however this does not happen with H5P activities. To get around the issue I am trying to implement an event to catch H5P activity completions, in particular in the case where the next activity has a restriction on the the completion of the activity. I have been able to use the EVENT API to catch the '\core\event\course_module_completion_updated' event, I am tried to force a page refresh from inside the event handle using "$PAGE->set_cacheable(false);" but it did not work.
Any suggestions?
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>;.
/**
 * Activity Completion Notification Event Observers.
 *
 * @package    local_modulecomplete_pagerefresh
 * @author     Paul McLennan
 * @copyright  2020 Paul McLennan
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die();
/**
 * Activity Completion Notification Event Observers.
 *
 * @package    local_modulecomplete_pagerefresh
 * @author     Paul McLennan
 * @copyright  2020 Paul McLennan
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class local_modulecomplete_pagerefresh_observer {
    /**
     * Event processor - user created
     *
     * @param \core\event\course_module_completion_updated $event
     * @return bool
     */
    public static function activity_completed(\core\event\course_module_completion_updated $event)
 {
//     $output = $PAGE->set_cacheable(false);
// echo $output;
        
return true;
    }
}
Average of ratings: Useful (1)