News for hackers. Stuff that matters.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by gojomo on Sunday June 03, 2012 @08:27PM (#4062158)
I get the benefit of PJAX when you're replacing part of a page. If you're replacing the whole page, how does this beat a real browser load of the exact same data in the same number of hits?

(Is it simply that it saves you the effort of setting your caching headers for inline resources properly?)

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Monday June 04, 2012 @01:41AM (#4062817)
Partially agree here with you.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by splitrocket on Sunday June 03, 2012 @06:37PM (#4061937)
Seems to break if you have a link without an href.

It also seems to blow away any previous listeners places on elements. Any plans to have callbacks for events so that listeners can be re-bound?

Aside from that, looks totally sweet. I'm going to use this in a bunch of places.

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Monday June 04, 2012 @01:48AM (#4062828)
Awful mistake, sorry, completely forgot about that issue. Will be fixed ASAP. However, there is "new" event, which gets fired on every new page. You can listen to it using $.joconut.on, see Readme in GitHub repository at https://github.com/vdemedes/joconut.

Thanks, glad you like it!

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by aseemk on Sunday June 03, 2012 @05:48PM (#4061847)
Great idea. I'm having trouble getting it to work ( https://github.com/vdemedes/joconut/issues/5 ), but I'm looking forward to trying it out!

One thought came to mind for a potential leaky abstraction: unlike HTML and CSS that can be "undone" and are idempotent, JS has side effects that can't be undone, and isn't always idempotent. Are there JS patterns we need to embrace or avoid to ensure Joconut always "just works"?

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by jasoncartwright on Sunday June 03, 2012 @02:51PM (#4061493)
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Sunday June 03, 2012 @02:59PM (#4061517)
Update pushed, issue fixed.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by dagingaa on Sunday June 03, 2012 @02:26PM (#4061434)
Missing some things:

- How is this different form the existing PJAX-plugin?

- Is there a demo page for this plugin?

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Sunday June 03, 2012 @03:03PM (#4061523)
Sorry, no demo page for now. It is different from PJAX in these ways:

1. 1kb minified and gzipped

2. Auto-loading of JS and CSS from new pages, if needed

3. No need to set up and configure

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by prezjordan on Sunday June 03, 2012 @04:50PM (#4061712)
What exactly does it do? I'm not sure if I follow completely.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by pygorex on Sunday June 03, 2012 @05:08PM (#4061761)
Loads pages via AJAX and updates the browser history using `pushState`. This is an alternative to the PJAX library: https://github.com/defunkt/jquery-pjax

Use either if you have an irrational aversion to page reloads.

Snark aside - jQuery Mobile uses a similar technique to cache entire pages in the DOM and for page transitions.

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by chrischen on Sunday June 03, 2012 @05:23PM (#4061792)
Or use if your site plays music :).
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by DigitalSea on Sunday June 03, 2012 @07:51PM (#4062080)
Beverly Hills Cop MIDI track? Yes.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Sunday June 03, 2012 @05:05PM (#4061750)
It allows loading pages without refreshing browser window. User will not notice any loading indicator/progress, pages will instantly "replace" each other.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by pygorex on Sunday June 03, 2012 @05:15PM (#4061775)
> User will not notice any loading indicator/progress, pages will instantly "replace" each other

Um, no. The pages won't "instantly" load - the browser still has to make a round trip to load the page content.

A loading or progress indicator should still be shown letting the user know that this round trip is taking place - especially important if you're on a slow US cell network. If a user is on a slow connection and no visual feedback is given they may end up mashing a link, making the load time worse - or, worse yet, assume the site is broken.

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Monday June 04, 2012 @01:51AM (#4062835)
Agree, I will add "before" and "after" events to the Joconut, so that developer can listen to them and display progress indicator he likes.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by nchuhoai on Sunday June 03, 2012 @02:30PM (#4061448)
Love to try this out, especially the loading scripts feature.

One question though: Is there any setup i need to do, or does it just fit right in with my existing pjax set-up?

Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Sunday June 03, 2012 @03:00PM (#4061519)
Nope, you just have to include joconut.js in the web page. It will do the rest.
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by cmer on Sunday June 03, 2012 @02:25PM (#4061432)
Could you explain what the benefits are over plain ol' vanilla PJAX? Thanks!
Re:Show HN: Joconut - Smart PJAX jQuery plugin in 1kb by vdemedes on Sunday June 03, 2012 @03:02PM (#4061521)
1. No need to set up, just script tag

2. 1kb minified and gzipped

3. Auto-load of additional JS and CSS from new pages, if needed