@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
37 lines (30 loc) • 1.41 kB
JavaScript
// eslint-disable-next-line no-undef
sap.ui.define([
"sap/ui/demo/nav/controller/BaseController",
"sap/base/Log"
], function(BaseController, Log) {
"use strict";
return BaseController.extend("sap.ui.demo.nav.controller.App", {
onInit: function () {
// This is ONLY for being used within the tutorial.
// The default log level of the current running environment may be higher than INFO,
// in order to see the debug info in the console, the log level needs to be explicitly
// set to INFO here.
// But for application development, the log level doesn't need to be set again in the code.
Log.setLevel(Log.Level.INFO);
var oRouter = this.getRouter();
oRouter.attachBypassed(function (oEvent) {
var sHash = oEvent.getParameter("hash");
// do something here, i.e. send logging data to the backend for analysis
// telling what resource the user tried to access...
Log.info("Sorry, but the hash '" + sHash + "' is invalid.", "The resource was not found.");
});
oRouter.attachRouteMatched(function (oEvent){
var sRouteName = oEvent.getParameter("name");
// do something, i.e. send usage statistics to backend
// in order to improve our app and the user experience (Build-Measure-Learn cycle)
Log.info("User accessed route " + sRouteName + ", timestamp = " + new Date().getTime());
});
}
});
});