Extend BaseWidget

JavaScript is not a classical language. It is a prototypical object-oriented language. To make developers comfortable with developing widgets, ArcGIS Web AppBuilder uses Dojo functions to create and extend classes. Web AppBuilder defines the BaseWidget class from which you create the Widget child class.

Open Widget.js in a text editor. The basic code for extending BaseWidget is as follows:

define(['dojo/_base/declare', 'jimu/BaseWidget'],
function(declare, BaseWidget) {
  //To create a widget, you need to derive from BaseWidget.
  return declare([BaseWidget], {
    // DemoWidget code goes here 


The above code declares the DemoWidget class as a child class of BaseWidget. For more information, see Dojo tutorials.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.