Comments (6)
Perhaps what we should maintain are a few different versions of this, at least initially for reference purposes. The version I first posted was't as tightly coupled with RequireJS (much like the above), but I would like to see whether we can use it and it's dependency management system to evolving the first version of the codebase into something simpler.
I'm happy to dig up an earlier implementation we can either store in a different directory (or in branch), but if you feel your approach differed from that one greatly (if you remember that version of the code) please feel free to send a PR my way!
from aura.
The only difference of the above code with your initial approach of aura is that you had:
facade.publish = function(channel) {
mediator.publish(channel);
}
instead of
facade.publish = function() {
args = [].slice.apply(arguments, [0, 2]); // first two arguments for mediator
arguments = [].slice.call(arguments, 2); // Rest for facade
mediator.publish.apply(mediator, args);
}
I prefer the second option to be honest.
Also the reason that I want to stick with the original version (and probably extend it a bit more) is that I personally develop apps in PHP and/or Node and for the apps I use 100% Node I tend to use Node's require instead of RequireJS since RequireJS is not the best way to go, also I had a discussion regarding requirejs with node so I end up using node module named modul8, as you can imagine if Aura is bound with RequireJS it will be hard for people who work with Node **-**RequireJS to use Aura, of course I could propose a node compatible version of Aura (which I plan to do for me) if you want so you could have a very basic example as the above + a node example without RequireJS.
from aura.
@panosru I would be fine with the second version to be honest. In a lot of cases, I've seen developers wishing to write for node opting for alternative module formats like CommonJS, whilst of course a RequireJS solution would work best with AMD (even though it can work with CJS modules too).
With this in mind, maybe what we could do is this:
- Original version / original with your tweaks
- RequireJS version (which is still in an experimental phase)
- Node version
I'm sure there will be room for overlap between the implementations, but maybe this would allow us to cover the stacks people will be most interested in.
from aura.
Yeap I agree :) I'll send a pull request most probably during this week :)
from aura.
Just to confirm: we've decided for the latest version to specifically use AMD for our module format and RequireJS as our loader. With respect to jQuery and Underscore, jQuery is used in the library but we're going to make it easier to switch out for something else. Underscore is just used for templating and can be replaced at any time with something else. Thanks!
from aura.
One way to make jquery more easily replaceable, is to reference 'jquery' as 'dom', or something similar, instead.
This is the approach I'm currently using in my app, to be able to switch between jquery and zepto more easily.
First the config can be changed to something like this:
require.config({
paths: {
dom: 'aura/lib/jquery'
}
});
You could then replace:
define(['jquery', 'underscore'], function ($, _) {
// ...
});
With this:
define(['dom', 'underscore'], function ($, _) {
// ...
});
Of course, this is a compile-time step, thus removing the ability to change the dom-library in the runtime. So if you want to have some client side check on which library to load, another approach might be better.
Just thought I'd share the idea.
from aura.
Related Issues (20)
- Doubt about duplicate element and maintain the associated events HOT 3
- Framework design flawed! Removing dependencies jQuery and Underscore. HOT 12
- Requirejs repair Tons of issues. HOT 1
- Mediator dependency removal Event Emitter HOT 3
- Support for loading of individually optimized components? HOT 15
- Asynchronous/dynamic loading of components? HOT 3
- Does Aurajs compatible with IE6? If not, how should I do to make it support?
- Error when manually loading a component
- Data management HOT 4
- ideas or plans about aura's job in relation with polymerjs HOT 5
- Can't go past a Grunt Task referring component initialize
- hi guys did you abandon the aura project? HOT 2
- Access to parent(super) methods within component HOT 1
- how to Concatenate the files of the decoupled modules HOT 4
- External links not working with Android webview HOT 1
- [BUSINESS CRITICAL] aurajs.com - github pages site is inaccessible HOT 6
- How to use jQuery and Flot with AuraJS ?
- Lightening component built upon aura js
- The project's domain is advertising some pocker stuff :)
- Aura
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aura.