How do I get a List instance in List.js

140 views Asked by At

I am initializing List.js (https://listjs.com/) in a file, and I need to get its instance from a different file. Say the first file contains something like:

var foo = document.getElementById('foo');
var listObj = new List(foo, {...});

Now I want to add some items to the list from a different file. However I don't have access to the listObj variable, so I need to get this List instance somehow. This is how I imaging this:

var foo = document.getElementById('foo');
var listObj = List.getInstance(foo).add(...);

So the question is if there is a a way to get a List.js instance by element? Thanks in advance.

0

There are 0 answers