Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/pubsub.min.js.map

{"version":3,"sources":["../src/pubsub.js"],"names":["events","subscribe","eventName","callback","push","unsubscribe","i","length","splice","publish","data","pendingPromise","Pending","forEach","resolve"],"mappings":"wKAsBA,uD,GAEMA,CAAAA,CAAM,CAAG,E,aAQU,QAAZC,CAAAA,SAAY,CAASC,CAAT,CAAoBC,CAApB,CAA8B,CACnDH,CAAM,CAACE,CAAD,CAAN,CAAoBF,CAAM,CAACE,CAAD,CAAN,EAAqB,EAAzC,CACAF,CAAM,CAACE,CAAD,CAAN,CAAkBE,IAAlB,CAAuBD,CAAvB,CACH,C,eAQ0B,QAAdE,CAAAA,WAAc,CAASH,CAAT,CAAoBC,CAApB,CAA8B,CACrD,GAAIH,CAAM,CAACE,CAAD,CAAV,CAAuB,CACnB,IAAK,GAAII,CAAAA,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGN,CAAM,CAACE,CAAD,CAAN,CAAkBK,MAAtC,CAA8CD,CAAC,EAA/C,CAAmD,CAC/C,GAAIN,CAAM,CAACE,CAAD,CAAN,CAAkBI,CAAlB,IAAyBH,CAA7B,CAAuC,CACnCH,CAAM,CAACE,CAAD,CAAN,CAAkBM,MAAlB,CAAyBF,CAAzB,CAA4B,CAA5B,EACA,KACH,CACJ,CACJ,CACJ,C,CAQM,GAAMG,CAAAA,CAAO,CAAG,SAASP,CAAT,CAAoBQ,CAApB,CAA0B,CAC7C,GAAMC,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,cAAgBV,CAA5B,CAAvB,CACA,GAAIF,CAAM,CAACE,CAAD,CAAV,CAAuB,CACnBF,CAAM,CAACE,CAAD,CAAN,CAAkBW,OAAlB,CAA0B,SAASV,CAAT,CAAmB,CACzCA,CAAQ,CAACO,CAAD,CACX,CAFD,CAGH,CACDC,CAAc,CAACG,OAAf,EACH,CARM,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A simple Javascript PubSub implementation.\n *\n * @module     core/pubsub\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Pending from 'core/pending';\n\nconst events = {};\n\n/**\n * Subscribe to an event.\n *\n * @param {string} eventName The name of the event to subscribe to.\n * @param {function} callback The callback function to run when eventName occurs.\n */\nexport const subscribe = function(eventName, callback) {\n    events[eventName] = events[eventName] || [];\n    events[eventName].push(callback);\n};\n\n/**\n * Unsubscribe from an event.\n *\n * @param {string} eventName The name of the event to unsubscribe from.\n * @param {function} callback The callback to unsubscribe.\n */\nexport const unsubscribe = function(eventName, callback) {\n    if (events[eventName]) {\n        for (var i = 0; i < events[eventName].length; i++) {\n            if (events[eventName][i] === callback) {\n                events[eventName].splice(i, 1);\n                break;\n            }\n        }\n    }\n};\n\n/**\n * Publish an event to all subscribers.\n *\n * @param {string} eventName The name of the event to publish.\n * @param {any} data The data to provide to the subscribed callbacks.\n */\nexport const publish = function(eventName, data) {\n    const pendingPromise = new Pending(\"Publishing \" + eventName);\n    if (events[eventName]) {\n        events[eventName].forEach(function(callback) {\n            callback(data);\n        });\n    }\n    pendingPromise.resolve();\n};\n"],"file":"pubsub.min.js"}