rumkin / pill

Add dynamic content loading to static sites with only 1 KiB of JS
https://rumkin.github.io/pill/
MIT License
383 stars 18 forks source link

API change #8

Closed tamb closed 5 years ago

tamb commented 5 years ago

8

I've created a PR for adding onMounting to your hooks.

However, I propose we come up with a consistent API.

Either stick with readyState API

    uninitialized - Has not started loading yet (fired everytime)
    loading - Is loading (fired during fetch)
    loaded - Has been loaded (fired everytime DOM is updated with content)
    interactive - Has loaded enough and the user can interact with it
    complete - Fully loaded

Or use another one.

I think something like:

onFetch - initial fetch of the page
onLoading/onMounting - content is loading (fired everytime content is changing)
onUnloading/onUnmounting - content is unloading from the page (fired everytime)

These hooks will give devs a chance to garbage collect, send analytics, etc.

rumkin commented 5 years ago

Good point, need to think about it.

tamb commented 5 years ago

Any shot this could be added?

rumkin commented 5 years ago

Sure. I've just reviewed all your PR, they require some changes. This PR is totally fine and just requires deletion of duplicated or unrelated changes.

tamb commented 5 years ago

I redid the pr entirely. My git got jacked up.

tamb commented 5 years ago

12