Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document new lazy loading feature #10361

Closed
wants to merge 5 commits into from
Closed

Conversation

lekoala
Copy link
Contributor

@lekoala lekoala commented Jun 22, 2022

@GuySartorelli here are the docs ;-)

PR reference : silverstripe/silverstripe-admin#1309

…/02_CMS_Architecture.md

Co-authored-by: Michal Kleiner <[email protected]>
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me so long to look at this. A few requested changes here.

Also I have started the process of migrating docs to a new repository, so this PR should be closed and a new one should be created there (sorry about that, poor timing).

They will receive a `lazyload` event that can be listened to in the following way:

```js
el.addEventListener(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we use pure javascript event handlers anywhere else in the documentation.... can you please change this to a jquery (and entwine if possible) reference to match the rest of the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(el).one('lazyload') should achieve the same results, but since this is expected to be used in third party modules, i don't see the issue not using jquery or entwine. Actually, that should be real goal: provide platform agnostic support so that it works with anything, no ?
I'm not even sure how that would work with entwine (i don't think it's possible to listen to a custom event only once ?)

Copy link
Member

@GuySartorelli GuySartorelli Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking about this - I think the main issue is that if you just drop this pure js into LeftAndMain.extra_requirements_javascript you won't even be able to find the element you want to add a listener to unless it's in an entwine onmatch (except for when you directly load the form the tab is in via URL). So we probably should add that context to the example. And by that point you're already in a jquery context anyway.

lekoala and others added 3 commits July 7, 2022 10:07
@GuySartorelli
Copy link
Member

Closed in favor of silverstripe/developer-docs#427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants