WAB Source Code of Layer List Widget

900
2
Jump to solution
11-28-2016 03:54 PM
LindaM
by
New Contributor II

In Web AppBuilder (Developer Edition), when I checked the source code of Layer List Widget (Widget.js) , I don't understand why there is always a comma at the end of each function such as below: This is not right in JavaScript grammar. Why? Thanks!

destroy: function() {
this._clearLayers();
this.inherited(arguments);
},

It should be :  var destroy = function () {...};

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Linda,


  Doing templated widget/dijit development in dojo is just different then the standard js development that you are use to.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Linda,


  Doing templated widget/dijit development in dojo is just different then the standard js development that you are use to.

TomTyndall1
New Contributor II

I think the issue is that the code you posted was embedded within a larger object. Notice how your code is: destroy: function () .... not destroy = function() ... 

Your code is defining a destroy property in an object, not a variable named destroy, so in this case the comma is correct (it separates the declaration of the destroy property from the declaration of whatever was the next property in the object). 

For example:

lifecycle = {

      destroy: function () {},

      create: function () {}

};