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

ES5 - ES6 Installation Errors #405

Open
jamesta696 opened this issue Nov 30, 2020 · 5 comments
Open

ES5 - ES6 Installation Errors #405

jamesta696 opened this issue Nov 30, 2020 · 5 comments

Comments

@jamesta696
Copy link

Having errors on simple ES5/6 installation. Please see screenshots.
Any way to get this fixed?

ES5 Installation
image
image

ES6 Installation
image
image

@azzahrah
Copy link

azzahrah commented Feb 9, 2021

Below is working for me...

<!DOCTYPE html>
<html lang="en">

<head>
    <title>W3.CSS Template</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
    <link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
    <script type="module">
        import * as PNotify from './node_modules/@pnotify/core/dist/PNotify.js';
        import * as PNotifyMobile from './node_modules/@pnotify/mobile/dist/PNotifyMobile.js';
    </script>

     <script type="text/javascript">
        window.addEventListener('DOMContentLoaded', () => {
            PNotify.defaultModules.set(PNotifyMobile, {});
            PNotify.alert({
                text: 'Notice me, senpai!'
            });
        });
    </script>
</head>

<body>
</body>

</html>

if you want another module like Confirm, so you must add link for PnotifyConfirm.css

    <link href="node_modules/@pnotify/confirm/dist/PNotifyConfirm.css" rel="stylesheet" type="text/css" />

also import module inside module area like this:

    <script type="module">
        import * as PNotify from './node_modules/@pnotify/core/dist/PNotify.js';
        import * as PNotifyMobile from './node_modules/@pnotify/mobile/dist/PNotifyMobile.js';
        import * as PNotifyConfirm'./node_modules/@pnotify/confirm/dist/PNotifyConfirm.js';
    </script>

and after export, you can use like this:

  <script type="text/javascript">
        window.addEventListener('DOMContentLoaded', () => {

            PNotify.defaultModules.set(PNotifyMobile, {});
            const notice = PNotify.notice({
                title: 'Confirmation Needed',
                text: 'Are you sure?',
                icon: 'fas fa-question-circle',
                hide: false,
                destroy: true,
                closer: false,
                sticker: false,
                modules: new Map([
                    ...PNotify.defaultModules,
                    [PNotifyConfirm, {
                        confirm: true
                    }]
                ])
            });
            notice.on('pnotify:confirm', () => alert('Ok, cool.'));
            notice.on('pnotify:cancel', () => alert('Oh ok. Chicken, I see.'));
        });
    </script>

for another module like desktop, you can doing like above step... but you must check apropriate file as you expected...

@jamesta696
Copy link
Author

Hi,
Since no devs had answered me I moved on to another library but I'll try this again when I get to the point I need it again.
I appreciate your feedback sir.

@azzahrah
Copy link

azzahrah commented Feb 9, 2021

@jamesta696 , can you telme what pnotify alternate?

@samuelsonokoi
Copy link

This might not be a perfect fix but it takes care of the compile-time errors for my angular application.

node_modules/@pnotify/core/Stack.d.ts you will have to modify line 1 to import { Notice } from './';

replace line 193 to 208 with the code below
swap( one: Notice, theOther: Notice, immediate: boolean, waitAfter: boolean ): Promise<unknown>;

replace line 220 with the following
fire(event: string, detail: {}): void;

In @pnotify/core/index.d.ts file replace line 250 with open(immediate?: boolean): Promise<unknown>; and replace line 261 to 265 with close( immediate?: boolean, timerHide?: boolean, waitAfterward?: boolean ): Promise<unknown>;

This fix worked for "pnotify": "^5.2.0", hopefully the next update will fix these error. Ummmm you might have to redo this again if you reinstall the same package.

@DJDaveMark
Copy link

DJDaveMark commented Apr 19, 2022

Today we wanted to update from 3.0.0 to 5.2.0, but we can't because of the same error described above for ES5 Installation.
We used the code described for Vanilla JS (ES5).
We also tried 5.1, 5.0, 4.0.1 ...same error, so I assume we'll have to wait until we port our code to ES2015 (ES6).

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

No branches or pull requests

4 participants