S
S
soulerik2018-09-25 00:15:03
JavaScript
soulerik, 2018-09-25 00:15:03

How to add your library to the code editor?

I wrote my own simple library, which is a set of objects with methods. Question: how to connect it to the VS Code code editor so that auto-substitution works when creating / editing other files?
Example:
Library:
libraryName.objectName = {};
libraryName.objectName.move = function (){...}
Usage:
write libraryName see the available set of objects to substitute
write libraryName.objectName. we see a set of methods of the object
It seems to be a banal question, but it is constantly googled that is not right.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Egorov, 2018-09-25
@soulerik

He should see it anyway, unless of course you connect it as needed.
Through importor require, or simply at the beginning of the file, insert the entire code.
For example:

// library.js
class Core {
    // code...
}

module.exports = Core;

// app.js
const library = require('./library.js');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question