NPM Resource Changed ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
19 Mar 2021

Pull Request for Issue # .

Summary of Changes

Earlier in the development of Joomla 4 we rolled out a wrapper around Events. At that time this was a good idea as we also had a polyfill for customEvent and our own implementation of {once: true}. Well, we don't need any of these anymore. Also, the introduction of a wrapper of a Platform feature seems counterproductive. IT's harder for newcomers to figure out their way around. Just use the propper docs from MDN ( https://developer.mozilla.org/en-US/docs/Web/Events ), job done!

Testing Instructions

Apply the PR and check:

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

No, actually this PR removes something that if we end up rolling in Joomla 4 we have to document. For the native Javascript events, we could just refer devs to MDN. Win!

@Fedik I know that you're against this, but honestly, I see no reason for Joomla to have such a wrapper

@wilsonge your decision

avatar dgrammatiko dgrammatiko - open - 19 Mar 2021
avatar dgrammatiko dgrammatiko - change - 19 Mar 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2021
Category JavaScript Repository NPM Change
avatar Fedik
Fedik - comment - 21 Mar 2021

well, if no one need it, then it can be merged I guess

Just use the propper docs from MDN, job done!

There also a big comment, related specifically to Joomla:

/**
* Dispatch custom event.
*
* An event name convention:
* The event name has at least two part, separated ":", eg `foo:bar`.
* Where the first part is an "event supporter",
* and second part is the event name which happened.
* Which is allow us to avoid possible collisions with another scripts
* and native DOM events.
* Joomla! CMS standard events should start from `joomla:`.
*
* Joomla! events:
* `joomla:updated` Dispatch it over the changed container,
* example after the content was updated via ajax
* `joomla:removed` The container was removed
*
* @param {HTMLElement|string} element DOM element, the event target. Or the event name,
* then the target will be a Window
* @param {String|Object} name The event name, or an optional parameters in case
* when "element" is an event name
* @param {Object} params An optional parameters. Allow to send a custom data
* through the event.
*
* @example
*
* Joomla.Event.dispatch(myElement, 'joomla:updated', {for: 'bar', foo2: 'bar2'});
* // Will dispatch event to myElement
* or:
* Joomla.Event.dispatch('joomla:updated', {for: 'bar', foo2: 'bar2'});
* // Will dispatch event to Window
*
* @since 4.0.0
*/
Joomla.Event.dispatch = (element, name, params) => {

But this can copied to jdocs.
I never done it, because I have no idea which section and I am very lazy.

avatar dgrammatiko
dgrammatiko - comment - 21 Mar 2021

There also a big comment, related specifically to Joomla:

We should really document everything in the core.js. I'm thinking a github based docs for the devs is much easier for devs to contribute than the wiki (another account? why, not my existing github account? also no markdown?). I haven't documented much myself but this is not necessarily because I'm lazy but also due to the fact that the wiki docs are extremely outdated. We are devs, we do github, let the devs doc LIVE on github...

avatar Fedik
Fedik - comment - 21 Mar 2021

Okay I have created the Doc page https://docs.joomla.org/J4.x:ClientSideEvents
Please review

avatar dgrammatiko
dgrammatiko - comment - 21 Mar 2021

It's perfect! ?

avatar dgrammatiko dgrammatiko - change - 28 Mar 2021
Labels Added: NPM Resource Changed ?
avatar Fedik Fedik - test_item - 28 Mar 2021 - Tested successfully
avatar Fedik
Fedik - comment - 28 Mar 2021

I have tested this item successfully on cb3f064


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32748.

avatar ceford
ceford - comment - 28 Mar 2021

Read the ClientSideEvents page. Perfect? Mmmmmm!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32748.

avatar jwaisner jwaisner - test_item - 18 Apr 2021 - Tested successfully
avatar jwaisner
jwaisner - comment - 18 Apr 2021

I have tested this item successfully on cb3f064


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32748.

avatar jwaisner jwaisner - change - 18 Apr 2021
Status Pending Ready to Commit
avatar jwaisner
jwaisner - comment - 18 Apr 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32748.

avatar rdeutz rdeutz - change - 19 Apr 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-04-19 06:28:09
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 19 Apr 2021
avatar rdeutz rdeutz - merge - 19 Apr 2021

Add a Comment

Login with GitHub to post a comment