| 1 | efrain | 1 | // This file is part of Moodle - http://moodle.org/
 | 
        
           |  |  | 2 | //
 | 
        
           |  |  | 3 | // Moodle is free software: you can redistribute it and/or modify
 | 
        
           |  |  | 4 | // it under the terms of the GNU General Public License as published by
 | 
        
           |  |  | 5 | // the Free Software Foundation, either version 3 of the License, or
 | 
        
           |  |  | 6 | // (at your option) any later version.
 | 
        
           |  |  | 7 | //
 | 
        
           |  |  | 8 | // Moodle is distributed in the hope that it will be useful,
 | 
        
           |  |  | 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
        
           |  |  | 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
        
           |  |  | 11 | // GNU General Public License for more details.
 | 
        
           |  |  | 12 | //
 | 
        
           |  |  | 13 | // You should have received a copy of the GNU General Public License
 | 
        
           |  |  | 14 | // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 | /**
 | 
        
           |  |  | 17 |  * Events for the mod_bigbluebuttonbn plugin.
 | 
        
           |  |  | 18 |  *
 | 
        
           |  |  | 19 |  * @module      mod_bigbluebuttonbn/events
 | 
        
           |  |  | 20 |  * @copyright   2021 Blindside Networks Inc
 | 
        
           |  |  | 21 |  * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 22 |  */
 | 
        
           |  |  | 23 |   | 
        
           |  |  | 24 | import {dispatchEvent} from 'core/event_dispatcher';
 | 
        
           |  |  | 25 |   | 
        
           |  |  | 26 | export const eventTypes = {
 | 
        
           |  |  | 27 |     /**
 | 
        
           |  |  | 28 |      * Fired when a session has been ended.
 | 
        
           |  |  | 29 |      *
 | 
        
           |  |  | 30 |      * @event mod_bigbluebuttonbn/sessionEnded
 | 
        
           |  |  | 31 |      * @type CustomEvent
 | 
        
           |  |  | 32 |      * @property {object} detail
 | 
        
           |  |  | 33 |      * @property {number} detail.bbbId
 | 
        
           |  |  | 34 |      * @property {number} detail.groupId
 | 
        
           |  |  | 35 |      */
 | 
        
           |  |  | 36 |     sessionEnded: 'mod_bigbluebuttonbn/sessionEnded',
 | 
        
           |  |  | 37 |   | 
        
           |  |  | 38 |     /**
 | 
        
           |  |  | 39 |      * Fired when the current session has been ended.
 | 
        
           |  |  | 40 |      *
 | 
        
           |  |  | 41 |      * @event mod_bigbluebuttonbn/currentSessionEnded
 | 
        
           |  |  | 42 |      * @type CustomEvent
 | 
        
           |  |  | 43 |      * @property {object} detail
 | 
        
           |  |  | 44 |      */
 | 
        
           |  |  | 45 |     currentSessionEnded: 'mod_bigbluebuttonbn/currentSessionEnded',
 | 
        
           |  |  | 46 | };
 | 
        
           |  |  | 47 |   | 
        
           |  |  | 48 | /**
 | 
        
           |  |  | 49 |  * Trigger the sessionEnded event.
 | 
        
           |  |  | 50 |  *
 | 
        
           |  |  | 51 |  * @param {number} bbbId
 | 
        
           |  |  | 52 |  * @param {number} groupId
 | 
        
           |  |  | 53 |  * @returns {CustomEvent}
 | 
        
           |  |  | 54 |  * @fires event:mod_bigbluebuttonbn/sessionEnded
 | 
        
           |  |  | 55 |  */
 | 
        
           |  |  | 56 | export const notifySessionEnded = (bbbId, groupId) => dispatchEvent(eventTypes.sessionEnded, {
 | 
        
           |  |  | 57 |     bbbId,
 | 
        
           |  |  | 58 |     groupId,
 | 
        
           |  |  | 59 | });
 | 
        
           |  |  | 60 |   | 
        
           |  |  | 61 | /**
 | 
        
           |  |  | 62 |  * Trigger the currentSessionEnded event.
 | 
        
           |  |  | 63 |  *
 | 
        
           |  |  | 64 |  * @param {Element} container
 | 
        
           |  |  | 65 |  * @returns {CustomEvent}
 | 
        
           |  |  | 66 |  * @fires event:mod_bigbluebuttonbn/currentSessionEnded
 | 
        
           |  |  | 67 |  */
 | 
        
           |  |  | 68 | export const notifyCurrentSessionEnded = container => dispatchEvent(
 | 
        
           |  |  | 69 |     eventTypes.currentSessionEnded,
 | 
        
           |  |  | 70 |     {},
 | 
        
           |  |  | 71 |     container
 | 
        
           |  |  | 72 | );
 |