SAP UI5 walkthrough 5 - 7 sap.ui.define(["sap/ui/core/mvc/Controller"]

59 阅读1分钟

Created by Wang, Jerry, last modified on Nov 02, 2015

 sap . ui . define ([ "sap/ui/core/mvc/Controller"  , "sap/m/MessageToast"  ], function ( Controller ,  MessageToast  ) { "use strict" ; return Controller . extend ( "sap.ui.demo.wt.controller.App" , {  onShowHello  : function () {  MessageToast . show ( "Hello World" );  } }); }); 

We extend the array of required modules with the fully qualified path to sap.m.MessageToast. Once both modules, Controller and MessageToast, are loaded, the callback function is called and we can make use of both objects by accessing the parameters passed on to the function.
This Asynchronous Module Definition (AMD) syntax allows to clearly separate the module loading from the code execution and greatly improves the performance of the application. The browser can decide when and how the resources are loaded prior to code exection.

clipboard1
clipboard2
clipboard3
clipboard4
clipboard5
clipboard6
clipboard7
clipboard8
clipboard9