rave-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jmeas Pls (JIRA)" <j...@apache.org>
Subject [jira] [Created] (RAVE-1104) Switch to alternate requireJS syntax
Date Tue, 08 Jul 2014 20:06:04 GMT
Jmeas Pls created RAVE-1104:
-------------------------------

             Summary: Switch to alternate requireJS syntax
                 Key: RAVE-1104
                 URL: https://issues.apache.org/jira/browse/RAVE-1104
             Project: Rave
          Issue Type: Bug
            Reporter: Jmeas Pls


The problem:

https://github.com/apache/rave/blob/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js#L20-L23

Why is this a problem:

This syntax is cumbersome, and from what I understand is only around for legacy reasons. Using
the CommonJS-style require syntax is much easier to read and maintain, and is less error-prone.
This is because you no longer need to match up the values in the array with the method signature,
which, as the above file shows, quickly becomes unwieldy.

The solution:

The alternate syntax (docs here: http://requirejs.org/docs/whyamd.html#sugar)

```js
define(function(require) {
  var _ = require('underscore');
  var Backbone = require('backbone');
});
```



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message