Last active
August 2, 2018 09:23
-
-
Save dpalou/aa7ff4484a9246ca7f0a6795850df520 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var that = this; | |
// Create a class that "inherits" from CoreCourseActivityPrefetchHandlerBase. | |
function AddonModCertificateModulePrefetchHandler() { | |
that.CoreCourseActivityPrefetchHandlerBase.call(this, that.TranslateService, that.CoreAppProvider, that.CoreUtilsProvider, | |
that.CoreCourseProvider, that.CoreFilepoolProvider, that.CoreSitesProvider, that.CoreDomUtilsProvider); | |
this.name = "AddonModCertificateModulePrefetchHandler"; | |
this.modName = "certificate"; | |
this.component = "AddonModCertificate"; | |
this.updatesNames = /^configuration$|^.*files$|^entries$/; | |
} | |
AddonModCertificateModulePrefetchHandler.prototype = Object.create(this.CoreCourseActivityPrefetchHandlerBase.prototype); | |
AddonModCertificateModulePrefetchHandler.prototype.constructor = AddonModCertificateModulePrefetchHandler; | |
// Override the prefetch call. | |
AddonModCertificateModulePrefetchHandler.prototype.prefetch = function(module, courseId, single, dirPath) { | |
return this.prefetchPackage(module, courseId, single, prefetchCertificate); | |
}; | |
function prefetchCertificate(module, courseId, single, siteId) { | |
// Perform all the WS calls. | |
// You can access most of the app providers using that.ClassName. E.g. that.CoreWSProvider.call(). | |
} | |
// Register the handler. | |
this.CoreCourseModulePrefetchDelegate.registerHandler(new AddonModCertificateModulePrefetchHandler()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment