[Proposal] Pjax as EventEmitter? #53

Closed
opened 2016-01-05 02:23:14 -05:00 by darylteo · 7 comments
darylteo commented 2016-01-05 02:23:14 -05:00 (Migrated from github.com)

At the moment, events are emitted via document using native dispatchEvent.

This (I think) causes issues if multiple instances of pjax are used.

Better to have Pjax as a EventEmitter emit its own events. This does increase the size of the library (4-5kb?).

At the moment, events are emitted via document using native dispatchEvent. This (I think) causes issues if multiple instances of pjax are used. Better to have Pjax as a EventEmitter emit its own events. This does increase the size of the library (4-5kb?).
MoOx commented 2016-01-05 02:24:59 -05:00 (Migrated from github.com)

Good idea.

Good idea.
BehindTheMath commented 2018-03-12 22:58:29 -05:00 (Migrated from github.com)

I think this will make testing easier and cleaner, as it will be easier to remove event listeners and avoid issues of event listeners on document carrying over between tests.

I think this will make testing easier and cleaner, as it will be easier to remove event listeners and avoid issues of event listeners on `document` carrying over between tests.
thewatts commented 2018-09-26 22:52:29 -05:00 (Migrated from github.com)

Oddly enough, I ran into this issue tonight.

I'm using multiple pjax instances to load in different URLs // selectors.

Once both are used, one stops working (events never fired, switches never fired, etc).

Sending in custom options via loadUrl isn't working either.

Is there a workaround for this?

Oddly enough, I ran into this issue tonight. I'm using multiple `pjax` instances to load in different URLs // selectors. Once both are used, one stops working (events never fired, switches never fired, etc). Sending in custom `options` via `loadUrl` isn't working either. Is there a workaround for this?
BehindTheMath commented 2018-09-26 23:07:14 -05:00 (Migrated from github.com)

Why do you need multiple instances?

Why do you need multiple instances?
thewatts commented 2018-09-26 23:10:40 -05:00 (Migrated from github.com)

@BehindTheMath I have one instance that loads in urls with specific selectors (main content), and another that's being used with a realtime filter (updates the filter's content, filter results)

@BehindTheMath I have one instance that loads in urls with specific selectors (main content), and another that's being used with a realtime filter (updates the filter's content, filter results)
BehindTheMath commented 2018-09-27 19:55:00 -05:00 (Migrated from github.com)

It's a bit hard to picture without seeing it, but Pjax is only meant to be used with links and submitting forms, not for filtering data.

It's a bit hard to picture without seeing it, but Pjax is only meant to be used with links and submitting forms, not for filtering data.
thewatts commented 2018-09-28 13:51:30 -05:00 (Migrated from github.com)

Pjax is only meant to be used with links and submitting forms, not for filtering data.

I'm using pjax to click a link, and selectively fetch the content from the URL - nothing different than what's detailed in the README, etc.

I just happen to be using multiple pjax instances :)


The issue itself is really hard to reproduce - so I'll table it for now. Just wasn't sure if there was a recommended way of handling the scenario of needing multiple instances.

Thanks!

> Pjax is only meant to be used with links and submitting forms, not for filtering data. I'm using pjax to click a link, and selectively fetch the content from the URL - nothing different than what's detailed in the README, etc. I just happen to be using multiple pjax instances :) --- The issue itself is really hard to reproduce - so I'll table it for now. Just wasn't sure if there was a recommended way of handling the scenario of needing multiple instances. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#53