How to use shared scripts?

123 views
Skip to first unread message

Sergio Spina

unread,
Apr 28, 2021, 7:36:50 PM4/28/21
to memento...@googlegroups.com
Hello.

How can I call a function in a script from a shared script?

Can I call a function defined in a shared script from a different library?

Should I use the js directives "export", "export default", "import ... from"?

Thanks for you answers.

Bill Crews

unread,
Apr 28, 2021, 9:16:09 PM4/28/21
to Sergio Spina, mementodatabase
Well, normally, action scripts & trigger scripts can call functions defined in either a shared script or our an an included external library, like moment.min.js. I haven't tried it, but I'm pretty sure you can call included library functions from a shared script. Now, if you write your own external library, like Sergio.js, and you want to call a shared script function from there, I haven't tried that yet; maybe you could tell us after trying it yourself?

--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mementodatabase/CAAoW_qFjc%2BiwXC95E16O5ZkZ5V-brQFGSd2Ne_WPHKLE71STog%40mail.gmail.com.

Gilles Mons

unread,
Apr 28, 2021, 10:18:40 PM4/28/21
to Sergio Spina, mementodatabase
Bonjour,

Voici une table que j'ai créer pour tester la mise à jour 

Hello,

Here is a table I created to test the update

Try Update

--

Bill Crews

unread,
Apr 29, 2021, 4:59:39 AM4/29/21
to Sergio Spina, mementodatabase
I decided to create a library demonstrating this stuff. Get it at http://libs.mobi/s/gSSmPPsaA.

The 1st entry #0 in these libraries of mine is to document what the library is about: it's purpose, what to look for, how to use, etc. I'm my opinion, Memento should have this built in, but since it doesn't, I resort to things like this.

The other entries are actual test entries. If you have questions, let me know.

--

Sergio Spina

unread,
May 7, 2021, 3:12:33 PM5/7/21
to mementodatabase
I'm sorry for the delay.

Thank you very much Bill for sharing your library, from which I have learned so much.

I thought (erroneously) that a "shared script" of a library would make its declarations public to other libraries and also to JavaScript fields. But that's not the case, and it seems to me that an opportunity has been missed.

Now I know that a "shared script" has a rather limited scope: only to "triggers" or "action" scripts and only within the same library.

Er Mo

unread,
May 7, 2021, 3:44:30 PM5/7/21
to mementodatabase
Hallo
Es gibt eine Möglichkeit ein Script in Form einer Funktion für alle Bibliotheken auf den Gerät zu machen . Man kan diese Funktion von überall Aufrufen und Ausfüren .

Hello
There is a possibility to make a script in the form of a function for all libraries on the device. You can call and execute this function from anywhere.

Bill Crews

unread,
May 7, 2021, 4:22:20 PM5/7/21
to Sergio Spina, mementodatabase
What you say is correct. Sergio, please know that the JavaScript field came 1st, when previously, there had been only calc fields, & the objective, as I was told, was to make it powerful yet simple to use. We may see it as limited now, but at that time, (for those who learned or knew JavaScript, it was the most powerful thing about Memento. Now, we (I, anyway) think of JavaScript fields as being the child or protegé of the really powerful stuff, the things that make use of the Memento JavaScript Library.

I don't know why he didn't make JavaScript fields able to call the MJL. Maybe no one ever asked for it? Maybe you could ask for it. Have you tried MementoUserVoice.com? You could check to see if it has already been requested, if not then request it, and you could notify us to vote for it, if you like.

Reply all
Reply to author
Forward
0 new messages