Exists "Require Once" in Javascript/Jquery

Asked

Viewed 444 times

-1

I made a class in JS (Model ES6), ta working beauty, but how do I put it in an external file and give, a Require Once how in PHP? Can you do this? Thanks ;)

1 answer

0

This depends on your environment, if you’re using jQuery in webbrowser (for example for a website), you can take a look at plugins like Browserify that make more or less the model of the require nodejs.

If you are using the Node environment, then just use the Node itself require, but I don’t believe there’s a require_once, even because objects are stored in variables, they are not incorporated into the environment.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.