-
Notifications
You must be signed in to change notification settings - Fork 0
Extensions
XHiddenProjects edited this page May 15, 2025
·
3 revisions
import { Extension, Config, Styles } from "../js/es6/mediaviewer-extension.js";
import {startup, ...} from 'js/es6/mediaviewer.js';
startup(); //Loads up the libraryTo write your start with this
// Extend your class with "Extension"
export const Demo = class extends Extension{
constructor(container,config,styles){
super(container,new Config().parse(config), new Styles().parse(styles));
}
}To execute
const x = new Demo(['.demo','.demo1'],{
MediaClassesFromImport: {
//Configurations
}
},{
MediaClassesFromImport:{
// Variable names
}
});
x.include(...MediaClassesFromImport);
/**
* There are two methods
* apply() or attach()
* ------------------------------------------------------
* apply() automatically adds the media to the page
* attach() doesn't automatically add the media to the page
*/
x.use(MediaClassesFromImport).apply();
// Or use the attach method
// x.use(MediaClassesFromImport).attach();
// new x.MediaClassesFromImport.constructor(...x.set(MediaClassesFromImport));