Comments (6)
@vtsurka You would call publish with some extra data:
// task list
sandbox.publish('task', 'detail', id);
// task detail
sandbox.subscribe('task', 'detail', function (caller, id) {
// Do things with id
});
If you check out the console when you run Aura you will see a bunch of messages like "Todos-bootstrap message from from: controls". Each of those messages are being published from one widget and subscribed by another widget. You just have to add the additional data to the call.
from aura.
@addyosmani I'd like to add another button to the controls that publishes extra data. If you agree, I'll commit.
from aura.
Fully agree. Feel free to :)
from aura.
Done.
from aura.
I expected send the id of model, but we have model 'Task' they use in widgets: TaskList, TaskDetailed.
Where i must store this model if they uses in both widgets.
I don't want duplicate model ;(
from aura.
I need generate page like this
When i click on link expand, will show detailed todo under row.
So i have todos(as like demo app) i add method show /widgets/views/todos.js
events: {
//... other events
'click .view': 'show',
},
//Show detailed info about task
show: function() {
sandbox.widgets.start('detailed',this.$el);
sandbox.widgets.publish('todo-detailed',this.model);
},
And i create widget detailed
Widget main.js
define(['sandbox', './views/app'], function (sandbox, AppView) {
return function (element) {
var view = new AppView({
el: sandbox.dom.find(element)
});
return view;
sandbox.subscribe('todo-detailed', 'detailed', function (todo) {
//apply model
view.model = todo;
});
};
});
View
define(['sandbox', 'text!../templates/detailed.html'], function (sandbox, template) {
var AppView = sandbox.mvc.View({
template: sandbox.template.parse(template),
events: {
'click .save': 'save',
'click .start': 'start',
'click .stop': 'stop'
},
// At initialization we bind to the relevant events on the `Todos`
// collection, when items are added or changed. Kick things off by
// loading any preexisting todos that might be saved in *localStorage*.
initialize: function () {
sandbox.widgets.start('todo-history','#todo-history');
sandbox.widgets.start('todo-comment','#todo-comment');
},
render: function() {
this.$el.html(this.template(this.model.toJSON()));
}
});
return AppView;
});
Is it right way to organize widget like this?
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.