Closed leeyaunlong closed 3 years ago
This depends on the library. Some libraries are sensitive on where they run, some work fine.
This is actually jQuery plugin, not sure how will that interact with internal jquery instance.
But in the case of cookies I would just paste some random function from stack overflow, it's not very difficult, e.g.
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
Thanks, zadam.
I use below way solved it.
import js file , named cookie_js, then
const jq_cookie = require('cookie_js')
Is it a right way to call 3rd js libs ? Why I need to this ? (the trilium example code can directly use the import jschat object)
If child nodes are named without special characters then they are automatically exported as variables into the namespace. In the hindsight this was probably not a good idea since it's not very intuitive.
I recommend using the CommonJS style require()
as in your example.
I write a plugin, it's work fine. I try to save some data to trilium desktop local cookie, so I import jquery js-cookie under my script. But it cannot work. Detail as below
note structure :
code
developer tool will return below error , how to solve it ?