0

The Web AppBuilder is a pure dojo, and Node.js application to build webmap applications by analyst that are not developers. However there is also a developer version where you can extend or build your own custom widgets.

In the Esri example: https://developers.arcgis.com/web-appbuilder/guide/create-a-feature-action-in-your-widget.htm they provide a code snippet but I'm a bit discombabulated. I can see dojo/_base/declare in the define module, but the jimu/BaseFeatureAction, jimu/WidgetManager, what js library it is? What is jimu.js and where can I find more information on it?

define([
  'dojo/_base/declare',
  'jimu/BaseFeatureAction',
  'jimu/WidgetManager'
], function(declare, BaseFeatureAction, WidgetManager){
  var clazz = declare(BaseFeatureAction, {

    iconFormat: 'png',

    isFeatureSupported: function(featureSet){
      return featureSet.features.length > 0 && featureSet.features[0].geometry.type !== 'point';
    },

    onExecute: function(featureSet){
      WidgetManager.getInstance().triggerWidgetOpen(this.widgetId)
      .then(function(myWidget) {
        var vertexCount = 0;
        featureSet.features.forEach(function(f){
          f.geometry.rings.forEach(function(r){
            vertexCount += r.length;
          });
        });
        myWidget.showVertexCount(vertexCount);
      });
    }

  });
  return clazz;
});
3

From the answer of an Esri staff member in this GeoNet thread, jimu.js is defined as follows:

The jimu.js library is the core source code inside every GIS app made by Web AppBuilder. The core dijits and classes in jimu.js are documented at https://developers.arcgis.com/web-appbuilder under the API Reference and Guide tabs.

The same answer also states:

We understand there is a lot to do in terms of documenting the extensible code in jimu.js and are working on a new system to enhance it.

If you open any Web AppBuilder Application source code you will see that the jimu.js folder is where stuff like styles (css), images, language handling (nls) and different utils are stored.

enter image description here

You can think of jimu.js as the core of the application where the whole interface, theme and default widgets are build upon. Furthermore, it provides tools to extend and customize an application in terms of both look & feel and functionality (i.e. widgets.)

For example, in the code you posted, the jimu/WidgetManager class provides a way of communicating with the Widget state (e.g. open or close the panel where the Widget is) from another .js file in your application. Regarding jimu/BaseFeatureAction it allows you to create custom feature actions without having to create them from scratch (such as the pan to or zoom to features when you click the three dots in a feature's popup).

A good place to start is reading the API reference and checking out the different samples ArcGIS provides.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.