How to init js lib at app start

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • flanklin
    Junior Member
    • Oct 2022
    • 19

    #1

    How to init js lib at app start

    Sometime, we use js lib and we need init it at app start, how to implement?
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9217

    #2
    It depends on what module format the lib is available. The most simple way is just include the file:


    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • flanklin
      Junior Member
      • Oct 2022
      • 19

      #3
      yuri thank for you reply. Our module in npm. I have imported via jsLibs.json then we need init module at app start. It like run a view on global
      Last edited by flanklin; 01-15-2024, 10:40 AM.

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9217

        #4
        If you configured it correctly in jsLibs, you require it it the script.

        PHP Code:
        require('your-lib-name'MyLib => {

        });
        ​ 
        It's hard to tell, too little information, there any many cases, it's a frontend JS, it's always tricky.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • flanklin
          Junior Member
          • Oct 2022
          • 19

          #5
          yuri thank for you reply,

          Example, I want to use google tag manager script then I need embed it after <body> tag. So how to do it?

          Comment

          Working...