Tengo que intentar crear alguna composición de prueba usando js, estoy siguiendo este artículo: https://www.koderhq.com/tutorial/javascript/composition/#what-is
tengo una clase js
class FileField { constructor () { } /** * Upload file to file field. * * @param {string} InputAttribute * @param {string} url * @param {string} AltAttribute */ uploadField(InputAttribute, url, AltAttribute ) {} } export default {FileField}
Y trato de usar esta clase de esta manera en otra clase:
import { DefaultContent } from "./DefaultContent/DefaultContent"; import { PROPERTY } from "./DefaultContent/DefaultContent"; import { FileField } from "./DefaultContent/FileField"; export default class ArticlePage extends DefaultContent { constructor(FileField) { this.fileField = new FileField(); } fillImageField() { // Upload the file this.fileField.uploadFile( this.imageInput, "/node/add/article?element_parents=field_image/widget/0&ajax_form=1&_wrapper_format=drupal_ajax", this.imageAltDescription, ); } }
Me sale el error: > FileField is not a constructor
He revisado artículos y preguntas de StackOverflow pero ninguno funciona con mi código.
Gracias.