Problem/Motivation

jQuery is deprecated, in pwa a2hs sub module.

Error of once function in console.

And the button "Add to home" is not presented.

Steps to reproduce

Drupal 10.1.1

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#9 jquery-deprecated-3373431-9.patch1.41 KBfromme

Issue fork pwa-3373431

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ady1503 created an issue. See original summary.

ady1503’s picture

I have made the following changes:
in pwa_a2hs.libraries.yml
dependencies:
- core/drupalSettings
- core/jquery
- core/once

and

in js/pwa_a2hs_prompt.js

(function ($, Drupal, once) {
'use strict'

// Use jQuery once() so the button doesn't get added multiple times.
$(once('showButton', '.pwa-a2hs', context)).each(function () {

})(jQuery, Drupal, once);

And the "Install APP" button works.

Commit if is correct.

Thanks

keshavv’s picture

Assigned: Unassigned » keshavv

keshavv’s picture

Status: Active » Needs review

jQuery.once is deprecated so we need this MR to be merged. Otherwise, JS will throw an error. Created the MR please review it.

ady1503’s picture

For mi, mi changes working well.

Don't forget, the manifest.json file is not loaded automatically.

anybody’s picture

Assigned: keshavv » Unassigned

Fixes LGTM, @Grevil could you please have a final look at this?

fromme made their first commit to this issue’s fork.

fromme’s picture

StatusFileSize
new1.41 KB

"Once" feature required core/drupal library (https://www.drupal.org/node/3158256), so i change core/drupalSettings to core/drupal (it already use drupalSettings as dependancy).
Also attached the patch for using it before changes will be released.

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Nice one @fromme! LGTM!

  • Anybody committed 3cbb71c7 on 2.x authored by keshav.k
    Issue #3373431 by keshav.k, fromme, Anybody: jQuery is deprecated, in...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Merged into 2.x dev!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.