@dosgato/templating 0.0.96 → 0.0.97

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.
@@ -82,14 +82,14 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
82
82
  * going to render anything. For instance, if we are rendering an '.ics' variation and this component
83
83
  * is not an event, it will not be participating and we'd like to avoid doing the work in the fetch().
84
84
  *
85
- * This variable is an array of extensions where we SHOULD run fetch(). The default is only run fetch
85
+ * This method returns an array of extensions where we SHOULD run fetch(). The default is only run fetch
86
86
  * on 'html'. Components that support other variations should override this method and opt in to more
87
87
  * extensions.
88
88
  *
89
89
  * The extensions listed should NOT include the preceding dot. In the case of an extended extension like
90
90
  * '.js.map', you should provide 'js.map'.
91
91
  */
92
- static variationsToFetch: string[];
92
+ variationsToFetch(): string[];
93
93
  /**
94
94
  * Some components may be inheritable to subpages within the same site. For instance, a site's
95
95
  * social media links may appear on every page's footer. To accomplish this in your template,
package/dist/component.js CHANGED
@@ -60,6 +60,24 @@ export class Component extends ResourceProvider {
60
60
  async fetch() {
61
61
  return undefined;
62
62
  }
63
+ /**
64
+ * Only run fetch for specific variations.
65
+ *
66
+ * Sometimes pages are requested with an alternate extension like .rss or .ics. See 'renderVariation'
67
+ * method for more discussion on this.
68
+ *
69
+ * When rendering variations, many components will not need to fetch anything, because they are not
70
+ * going to render anything. For instance, if we are rendering an '.ics' variation and this component
71
+ * is not an event, it will not be participating and we'd like to avoid doing the work in the fetch().
72
+ *
73
+ * This method returns an array of extensions where we SHOULD run fetch(). The default is only run fetch
74
+ * on 'html'. Components that support other variations should override this method and opt in to more
75
+ * extensions.
76
+ *
77
+ * The extensions listed should NOT include the preceding dot. In the case of an extended extension like
78
+ * '.js.map', you should provide 'js.map'.
79
+ */
80
+ variationsToFetch() { return ['html']; }
63
81
  /**
64
82
  * Inherit components from another page with matching area
65
83
  *
@@ -255,24 +273,6 @@ export class Component extends ResourceProvider {
255
273
  this.parent?.passError(e, path);
256
274
  }
257
275
  }
258
- /**
259
- * Only run fetch for specific variations.
260
- *
261
- * Sometimes pages are requested with an alternate extension like .rss or .ics. See 'renderVariation'
262
- * method for more discussion on this.
263
- *
264
- * When rendering variations, many components will not need to fetch anything, because they are not
265
- * going to render anything. For instance, if we are rendering an '.ics' variation and this component
266
- * is not an event, it will not be participating and we'd like to avoid doing the work in the fetch().
267
- *
268
- * This variable is an array of extensions where we SHOULD run fetch(). The default is only run fetch
269
- * on 'html'. Components that support other variations should override this method and opt in to more
270
- * extensions.
271
- *
272
- * The extensions listed should NOT include the preceding dot. In the case of an extended extension like
273
- * '.js.map', you should provide 'js.map'.
274
- */
275
- Component.variationsToFetch = ['html'];
276
276
  export class Page extends Component {
277
277
  constructor(page, editMode, extension) {
278
278
  super(page.data, '', undefined, editMode, extension);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.96",
3
+ "version": "0.0.97",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {