I have a question regarding best practices concerning the usage of libraries (like jQuery, handlebars, underscore, ...)
The readme from the project states:
"Abstract away utility libraries you are using (templating, DOM manipulation) so that you can swap them out for alternatives at any time without a great deal of effort."
If I understand correctly, this would be done by using extensions that add the library's functionality to app.core, but in a way so as to make these extensions to core library-independent.
Example:
- Library "a" has function "sum(x, y)" that adds x and y.
- Library "b" has function "add(x, y)" that adds x and y.
Would you then create these extensions?
- Extension "aura-a" that extends app.core.math with a function sum(x, y) which would execute the sum function from library "a"
- Extenstion "aura-b" that extends app.core.math with a function sum(x,y) which would execute the add function from library "b"
If I am correct in my assumptions, are there any of these extensions already available? The aura-examples I've seen don't seem to use a lot of libraries yet, mostly underscore which is usually used directly instead of using an extension that adds underscore functionality to app.sandbox.util
One thing I've seen is the aura-handlebars extension in aura-todos:
initialize: function(app) {
var Handlebars = require('handlebars');
app.core.template.hbs = Handlebars;
}
This seems to contradict my understanding of how extensions should be used since it just inserts handlebars as-is.
I have a question regarding best practices concerning the usage of libraries (like jQuery, handlebars, underscore, ...)
The readme from the project states:
"Abstract away utility libraries you are using (templating, DOM manipulation) so that you can swap them out for alternatives at any time without a great deal of effort."
If I understand correctly, this would be done by using extensions that add the library's functionality to app.core, but in a way so as to make these extensions to core library-independent.
Example:
Would you then create these extensions?
If I am correct in my assumptions, are there any of these extensions already available? The aura-examples I've seen don't seem to use a lot of libraries yet, mostly underscore which is usually used directly instead of using an extension that adds underscore functionality to app.sandbox.util
One thing I've seen is the aura-handlebars extension in aura-todos:
This seems to contradict my understanding of how extensions should be used since it just inserts handlebars as-is.