Hi Joshua! Is it still alive ? Can't reach https://talk.tiddlywiki.org/ 🤔
On Wednesday, 27 April 2022 at 18:16:31 UTC+3 Joshua Fontany wrote: > Much more activity at https://talk.tiddlywiki.org/. Try over there. :) > > On Wednesday, October 27, 2021 at 1:14:54 AM UTC-7 [email protected] > wrote: > >> Hi guys, >> >> I need a bit of help to understand how to access getTiddler method from >> a javascript library >> >> When I develop *macro* (module-type) I use this.wiki. filterTiddlers >> (...) methods and all works fine when I invoke this macro from a tiddler >> script >> >> But I would like to develop a javascript library that is intended to be >> used by different macros. This library will need to access a Data Tiddler >> (as a DB "backend") >> >> So I created a javascript code and set its module-type to *library* >> The code is the following >> >> (function(){ >> class Hero { >> constructor(name, level) { >> var stats_tiddler_title = "Stats_report"; // a backend tiddler that >> contains the stats reports (as field value) >> var stats_tiddler_filter = "[["+stats_tiddler_title+"]]"; >> var stats_tiddlers = this.wiki.filterTiddlers(stats_tiddler_filter); >> this.name = name; >> this.level = level; >> console.log(" Class created. Value:"+this.level); >> } >> getName() { >> console.log(" getName !!!!!. Name:"+this.name); >> } >> } >> exports.Hero = Hero; >> >> })(); >> >> From my macro javascript I tried to call this library >> >> var Hero = require('$:/plugins/vpl/vpl_test_class.js').Hero; >> const hero1 = new Hero('Varg', 1); >> >> But I get the error >> Uncaught TypeError: Cannot read properties of undefined (reading >> 'filterTiddlers') >> >> I'm blocked .... Can someone help & guide me on the proper way to do that >> ? >> >> Thanks very much for your help >> >> Regards >> >> -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/tiddlywikidev/8cfc66f7-af21-4bc5-b18e-ec00c8d881d7n%40googlegroups.com.
