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

Respond to the /justuno/service-worker.js request with the provided JavaScript #10

Closed
dmitrii-fediuk opened this issue Mar 13, 2020 · 1 comment

Comments

@dmitrii-fediuk
Copy link
Contributor

upwork.com/messages/rooms/room_e6b2d182b68bdb5e9bf343521534b1b6/story_5b53d035f300a4c8532b0072e9b96680

We need both apps to automatically create a route to www.sitedomain.com/app/justuno/service-worker.js
Here's the file that needs to be made available at that route

self.addEventListener('push', function (event) {
    console.log('Push message!', event.data.text());
    const payload = JSON.parse(event.data.text());

    event.waitUntil(
        self.registration.showNotification(payload.title, {
            body: payload.body,
            requireInteraction: payload.requireInteraction,
            icon: payload.icon,
            image: payload.image,
            data: {
                link: payload.link
            }
        }));
});

self.addEventListener('notificationclick', function (event) {
    console.log('Notification click: tag', event.notification.tag);
    event.notification.close();
    if (event.notification.data.link) event.waitUntil(clients.openWindow(event.notification.data.link));
});
@dmitrii-fediuk dmitrii-fediuk changed the title Respond to the /app/justuno/service-worker.js with the provided JavaScript Respond to the /justuno/js/service-worker request with the provided JavaScript Mar 13, 2020
@dmitrii-fediuk dmitrii-fediuk changed the title Respond to the /justuno/js/service-worker request with the provided JavaScript Respond to the /justuno/js/serviceWorker request with the provided JavaScript Mar 13, 2020
@dmitrii-fediuk dmitrii-fediuk changed the title Respond to the /justuno/js/serviceWorker request with the provided JavaScript Respond to the /justuno/js/service-worker.js request with the provided JavaScript Mar 13, 2020
@dmitrii-fediuk dmitrii-fediuk changed the title Respond to the /justuno/js/service-worker.js request with the provided JavaScript Respond to the /justuno/service-worker.js request with the provided JavaScript Mar 13, 2020
dmitrii-fediuk added a commit to mage2pro/core that referenced this issue Mar 14, 2020
dmitrii-fediuk added a commit that referenced this issue Mar 14, 2020
@dmitrii-fediuk
Copy link
Contributor Author

Done in 1.2.6.

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

No branches or pull requests

1 participant