1

We are coding most of the things in our project in declarative way and the event handling is done in tag or loaded in .js file.

Declarative way in the code:

<input id="testid" data-dojo-type="dijit.form.FilteringSelect"
       data-dojo-props="store:teststore, searchAttr:'display'"
       style="width:100%" onchange="changeOtherCombo"></input>

<script>
function changeOtherCombo(newValue)
{

}
</script>

AMD usage in the code:

however we are still are able to use AMD way in our code in the files for example:

require(["dijit/Tooltip", "dojo/domReady!"], function(Tooltip){
        new Tooltip({
            connectId: ["testtooltoop"],
            label: "tool tip to show"
        });
});

<div id="testtooltoop" ></div>

I have few questions to proceed the way we are coding so that we shall be compatible with DOJO 2.0

  1. Is it good to code in declarative way?
  2. Will the declarative way of coding continue in feature releases in dojo?
  3. Is it good to move all the declarative code to AMD way of coding or keep the code as it is in declarative now start new once in AMD programmatic way?
  4. Will the performance affect in declarative way of coding?
Paul Grime
  • 14,970
  • 4
  • 36
  • 58
user1716006
  • 51
  • 4
  • 11
  • 1
    I think it wil affect the performance a bit. When you use the declarative way you have to parse your widgets. Either by using `parseOnLoad` or by manually parsing it with the `dojo/parser` module. This is an extra action and so it could affect the performance a bit I think. – g00glen00b Jun 19 '13 at 06:16
  • will "parseOnLoad" supported in 2.0 or everything should be moved to AMD to support 2.0? – user1716006 Jun 20 '13 at 09:40
  • I don't think they're planning to remove the declarative way of creating widgets, so I don't think they will remove the `parseOnLoad`. The only thing that is being removed (as far as I know) is the old syntax, for example: `dojo.byId`, `dojo.require`, ... . That's what you have to replace with the AMD syntax. – g00glen00b Jun 20 '13 at 09:52
  • Thanks...I found a link which is a migration guide http://livedocs.dojotoolkit.org/releasenotes/migration-2.0 – user1716006 Jun 20 '13 at 11:08
  • Yes, the docs say the same thing I did. You can still use declarative widgets. Only the JavaScript code (if you have some) will change to AMD syntax. – g00glen00b Jun 20 '13 at 11:53
  • This question was useful to me :) – Krishna Sep 04 '13 at 10:26

0 Answers0