tw5-typed 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/widget.d.ts +16 -0
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "description": "Types for tiddlywiki",
3
3
  "license": "MIT",
4
4
  "name": "tw5-typed",
5
- "version": "0.1.3",
5
+ "version": "0.1.4",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
package/src/widget.d.ts CHANGED
@@ -38,5 +38,21 @@ declare module 'tiddlywiki' {
38
38
  * @param fallbackText default value if the attribute is not set
39
39
  */
40
40
  getAttribute(name: string, fallbackText?: string): string;
41
+ /**
42
+ * Get variable in the context of the widget.
43
+ * Simplified version of getVariableInfo() that just returns the text.
44
+ * @param name variable name, for example, `actions` in the button widget
45
+ * @param options options for getVariableInfo()
46
+ *
47
+ * Options include
48
+ params: array of {name:, value:} for each parameter
49
+ defaultValue: default value if the variable is not defined
50
+
51
+ Returns an object with the following fields:
52
+
53
+ params: array of {name:,value:} of parameters passed to wikitext variables
54
+ text: text of variable, with parameters properly substituted
55
+ */
56
+ getVariable(name: string, options?: object): string;
41
57
  }
42
58
  }