0 votes
by (160 points)

So i would like to import a libray in javascript like this one  :


in the global javascript import in twine



but also in a passage i would like to use javascript.



how to do that please ?



1 Answer

+1 vote
by (159k points)
selected by
Best answer

Please use the question Tags instead of the question Title to state the name and full version number of your story format.

... import a library in JavaScript like this one

You can use code like the following within your story's Story Javascript area to programmatically load an external JavaScript file.

(function ($) {
			id   : 'script-pouch-db',
			type : 'text/javascript',
			src  : 'https://cdn.jsdelivr.net/npm/pouchdb@6.3.4/dist/pouchdb.min.js'

Unfortunately the Harlowe story format (both 1.x and 2.x) has been deliberately designed in such a way that makes using Javascript to extend it's core functionality difficult, especially if you want to access or alter the values of story variables.

Could you give more details on exactly what you want to use the PounchDB library for so that anyone answering your question can give you better advice on how you might achieve those outcomes within Harlowe.