some small progress

This commit is contained in:
2024-01-09 20:21:50 +01:00
parent e326b2635f
commit 472e6d0f19

View File

@@ -30,20 +30,23 @@
// has all of these files combined into a single file, as to enable a simple include. // has all of these files combined into a single file, as to enable a simple include.
interface Window { interface Window {
impress: Function; impress;
} }
window.impress = () => { window.impress = () => {
/** /**
* This function is used to initialize impress. It calls some prep functions and then loads * This function is used to initialize impress. It calls some prep functions and then loads
* all plugins that are registered. By default, these are the built-in plugins. You can define * all plugins that are registered. By default, these are the built-in plugins. You can define
* which plugins are loaded by passing in an array of plugin-functions into the init function * which plugins are loaded by passing in an array of plugin-functions into the init function
* @param {Array<String>} [pluginsToLoad] * @param {Array<String>|undefined} [pluginsToLoad] An array of plugins to load when initializing impress.
* Defaults to the built-in plugins.
* @returns {undefined} * @returns {undefined}
*/ */
var init: Function = ( pluginsToLoad?: Array<String> ): undefined => { var init = ( pluginsToLoad?: Array<string> ): undefined => {
let toBeLoadedPlugins: Array<string> = [''];
if ( typeof pluginsToLoad !== 'undefined' ) { if ( typeof pluginsToLoad !== 'undefined' ) {
toBeLoadedPlugins = pluginsToLoad;
} }
console.log( 'init' ); console.log( 'init' );
}; };
@@ -55,30 +58,29 @@ window.impress = () => {
* generated element. This allows for example the Overview plugin to work as it does. * generated element. This allows for example the Overview plugin to work as it does.
* *
* Returns true if successful at positioning this element, false, if failed * Returns true if successful at positioning this element, false, if failed
* @param {string} DOMElementID * @param {string} DOMElementID The DOM ID of the element to add to impress
* @param {object} coordinates * @param {object} coordinates An object representing the position in the 3D canvas
* @param {number} coordinates.x The translation in direction of x-axis * @param {number} coordinates.x The translation in direction of x-axis
* @param {number} coordinates.y The translation in direction of y-axis * @param {number} coordinates.y The translation in direction of y-axis
* @param {number} coordinates.z The translation in direction of z-axis * @param {number} coordinates.z The translation in direction of z-axis
* @param {object} rotation * @param {object} rotation An object representing the rotation around the x, y and z-axis
* @param {number} rotation.x The rotation in degrees around the x-axis * @param {number} rotation.x The rotation in degrees around the x-axis
* @param {number} rotation.y The rotation in degrees around the y-axis * @param {number} rotation.y The rotation in degrees around the y-axis
* @param {number} rotation.z The rotation in degrees around the z-axis * @param {number} rotation.z The rotation in degrees around the z-axis
* @returns {boolean} * @returns {undefined}
*/ */
var addElement: Function = ( DOMElementID: string, coordinates: { x: number; y: number; z: number; }, rotation: { x: number; y: number; z: number; } ): boolean => { var addElement: Function = ( DOMElementID: string, coordinates: { x: number; y: number; z: number; }, rotation: { x: number; y: number; z: number; } ): undefined => {
console.log( 'element added' ); console.log( 'element added' );
return true;
}; };
/** /**
* This function allows you to remove an element from the virtual canvas. Essentially, * This function allows you to remove an element from the virtual canvas. Essentially,
* impress.js just hides this element and ignores it in translations & rotations * impress.js just hides this element and ignores it in translations & rotations
* @param {string} DOMElementID The element that is removed. Has to be the element ID of a DOM element * @param {string} DOMElementID The element that is removed. Has to be the element ID of a DOM element
* @returns {boolean} * @returns {undefined}
*/ */
var removeElement = ( DOMElementID: string ): boolean => { var removeElement = ( DOMElementID: string ): undefined => {
return true; console.log( 'hello' );
}; };
/** /**
@@ -87,11 +89,9 @@ window.impress = () => {
* @param {object} rotation * @param {object} rotation
* @returns {promise} * @returns {promise}
*/ */
var moveTo = ( coordinates: object, rotation: object ): Promise<any> => { var moveTo = ( coordinates: object, rotation: object ): Promise<boolean> => new Promise( ( resolve, reject ) => {
return new Promise( ( resolve, reject ) => { resolve( true );
} );
} );
}
return { return {
init init