0

When I called this js file I got error that I cant use import into kind of this page,How I can use module file into a written prototype js file?

import * as storeDB from './publish.storedb.js';
import * as connectionString from './publish.connectionstring.js';
function serviceManager() { }
serviceManager.prototype = (function () {
 const _discardProcess = function (processCreationID, DiscardProcessDesc) {
        return new Promise((resolve, reject) => {
            try {
                $.ajax({
                    data: {
                        processCreationID: processCreationID,
                        discardProcessDesc: DiscardProcessDesc
                    },
                    method: 'POST',
                    url: '/Process/DiscardProcess',
                }).done((data) => {
                    if (data['HasError']) {
                        reject({ state: 'error', content: data });
                    }
                    else {
                        resolve({ state: 'done', content: data });
                    }
                }).fail((errorThrown) => {
                    reject({ state: 'fail', content: errorThrown });
                });
            }
            catch (error) {
                reject({ state: 'catch', content: error });
            }
        })
    };
)}();
5
  • Hi, i think you are looking for this youtube.com/watch?v=s9kNndJLOjg. Commented Jun 8, 2021 at 4:41
  • @PawanBishnoi I did this module and I have not problem with this It's okay. My problem is that when I want import module file in prototype written file. Commented Jun 8, 2021 at 5:01
  • 1
    Have you tried var publish = require("./publish.storedb.js") instead of import ? Commented Jun 8, 2021 at 5:56
  • You should also look this post stackoverflow.com/q/2772694/11358033. Commented Jun 8, 2021 at 6:07
  • No,I will try require .Thank you. Commented Jun 8, 2021 at 6:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.