? ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
8 Aug 2018

Pull Request for Issue # .

Summary of Changes

Deprecating the spinner creator in core.js. Joomla 4 will introduce a web component for this.

So in 4.0 in each page that a spinner is needed the following steps will need to be done:

  • Include the web component
HTMLHelper::_('webcomponent', 'system/webcomponents/joomla-core-loader.min.js', ['relative' => true, 'version' => 'auto']);
  • To show the spinner all we need to do is create an element:
spinner = document.createElement('joomla-core-loader');

// Assuming that the spinner is full screen
document.body.appendChild(spinner);

/*
if we need to append the spinner to some other container
all we have to do is replace document.body with the element 
that we want the spinner to appear
*/
  • To remove the spinner all we need to do is destroy the element:
spinner = document.querySelector('joomla-core-loader');

spinner.parentNode.removeChild(spinner);

Testing Instructions

Expected result

Actual result

Documentation Changes Required

@wilsonge @mbabker

avatar dgrammatiko dgrammatiko - open - 8 Aug 2018
avatar dgrammatiko dgrammatiko - change - 8 Aug 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Aug 2018
Category JavaScript
avatar dgrammatiko dgrammatiko - change - 8 Aug 2018
Labels Added: ?
avatar brianteeman brianteeman - test_item - 8 Aug 2018 - Tested successfully
avatar brianteeman
brianteeman - comment - 8 Aug 2018

I have tested this item successfully on b600771


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

avatar laoneo
laoneo - comment - 9 Aug 2018

Will the old way also work in J4?

avatar dgrammatiko
dgrammatiko - comment - 9 Aug 2018

Will the old way also work in J4?

No

avatar laoneo
laoneo - comment - 9 Aug 2018

And I assume the new way will also not work in J3. So what does an extension dev need to do then? In PHP you can write a version compare check and then execute the relevant code depending n the major version. How do we do that on the JS side? The target is that J3 extensions will also work in J4 if they are up to date.

avatar dgrammatiko
dgrammatiko - comment - 9 Aug 2018

So what does an extension dev need to do then?

I provided the lines above the missing step, lets say if you have crap build tools and you use the same codebase for different versions is quite simple:

if (Joomla.loadingLayer && typeof Joomla.loadingLayer === 'function') {
 // We are in J3 so use the old method
} else {
 // We are in the future
spinner = document.createElement('joomla-core-loader');
document.body.appendChild(spinner);
}

So basically it's almost the same as the JVersion trick for the PHP part.

avatar laoneo laoneo - test_item - 10 Aug 2018 - Tested successfully
avatar laoneo
laoneo - comment - 10 Aug 2018

I have tested this item successfully on b600771


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

avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Aug 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Aug 2018

Ready to Commit after two successful tests.

avatar laoneo laoneo - change - 10 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Aug 2018
Category JavaScript JavaScript Unit Tests
avatar laoneo laoneo - change - 10 Aug 2018
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 10 Aug 2018
Category JavaScript Unit Tests JavaScript
avatar mbabker mbabker - change - 18 Aug 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-08-18 15:54:40
Closed_By mbabker
Labels Removed: ?
avatar mbabker mbabker - close - 18 Aug 2018
avatar mbabker mbabker - merge - 18 Aug 2018

Add a Comment

Login with GitHub to post a comment