actually i haven't tried this, just because i was afraid of asking too
much of sammy :)
also i got confused about some ideas like the following:
(1) =run=> #/firstHellofromApps1n2
---
(2.1) app1(/#firstHellofromApps1n2) =redirect=> #/hellofromApp1
(2.2) app1(/#hellofromApp1) =redirect=> #/secondHellofromApps1n2
(2.3) app1(#/secondHellofromApps1n2) => log(23)
(2.4) app2(#/secondHellofromApps1n2) => log(24)
---
(3.1) app2(/#firstHellofromApps1n2) =redirect=> #/hellofromApp2
(3.2) app2(/#hellofromapp2) =redirect=> #/secondHellofromApps1n2
(3.3) nothing happens here, as app1 is already uptodate
(3.4) app2(#/secondHellofromApps1n2) => log(34)
===
logged 23,24,34
or maybe i am wrong, and the order would look like:
(1) =run=> #/firstHellofromApps1n2
---
(2.1) app1(/#firstHellofromApps1n2) =redirect=> #/hellofromApp1
(2.2) app2(/#firstHellofromApps1n2) =redirect=> #/hellofromApp2
---
(3.1) app1(/#hellofromApp1) =redirect=> #/secondHellofromApps1n2
(3.2) app2(/#hellofromApp2) =redirect=> #/secondHellofromApps1n2
---
(4.1) app1(#/secondHellofromApps1n2) => log(1)
(4.2) app2(#/secondHellofromApps1n2) => log(2)
===
logged 41, 42
and i suspect a lot more difficult ideas to be out there :)
cheers,
dpree
On 15 Dez., 22:17, Aaron Quint <aa...@quirkey.com> wrote:
> dpree - yeah, you're exactly right, because the 'last_location' of app
> 2 is #/hello2 it wont be triggered again by a redirect. FYI, you can
> also define the 'same' route for multiple apps, e.g.:
>
> var app1 = $.sammy(function() {
> this.get('#/hello', function() {
> this.log('hello from app1');
> });
>
> });
>
> var app2 = $.sammy(function() {
> this.get('#/hello', function() {
> this.log('hello from app2');
> });
>
> });
>
> when hitting #/hello should log
> 'hello from app1'
> 'hello from app2'
>
> --AQ
>
> Aaron Quinthttp://www.quirkey.com
--AQ
Aaron Quint
http://www.quirkey.com
ever since the first time i heard about sammy, the fact that there is
"only one hash per document" in combination with the impression that
sammy is very "hash-centric" makes me uncertain..
i am still looking for the best approach/framework to develop
javascript-based-singlepage-webapps/RIAs in terms of simplicity/
flexibility...
as i do not have enough time to evaluate all of these heavyweight-
approaches - like extjs3/sproutcore/yui3/javascriptmvc/cappuccino or
whatsoever - for the moment, jQ/sammy is the way i go..
so i am very excited about things like proxys :)
cheers,
dpree
On 18 Dez., 21:42, Aaron Quint <aa...@quirkey.com> wrote:
> Well the one thing about having multiple apps, is that if you're using
> the hash (#) to track state, both apps have to agree on being in the
> same state at the same time as theres only one hash per document.
> However, you can maitain the state in an internal variable, the
> benefit being you can have multiple apps in multiple states on a
> single page. This isnt super super easy now, but Sammy 0.4 (coming
> soon) will support creating proxys that define how state is
> maintained.
>
> --AQ
>
> Aaron Quinthttp://www.quirkey.com