restructure, move to TS

This commit is contained in:
2024-01-08 20:37:18 +01:00
parent 125ab80766
commit 90653fa34e
9 changed files with 344 additions and 88 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
/node_modules
/npm-debug.log
/*.tgz
/dist
# Files for editors and other tools
/.brackets.json

388
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@
"test": "npm exec -- karma start --log-level debug --single-run=true"
},
"devDependencies": {
"eslint": "^8.56.0",
"jscs": "^2.1.1",
"jshint": "^2.11.0",
"karma": "^6.4.2",
@@ -41,6 +42,6 @@
"qunit-assert-close": "^2.1.2",
"syn": "^0.14.1",
"terser": "^4.6.7",
"eslint": "^8.56.0"
"typescript": "^5.3.3"
}
}

View File

@@ -33,7 +33,7 @@ window.impress = () => {
// this function is used to initialize impress. It calls various private functions that initialize
// various components
var init = () => {
var init: Function = () => {
console.log( 'init' );
};
@@ -48,22 +48,42 @@ window.impress = () => {
* Returns true if successful at positioning this element, false, if failed
* @param {string} DOMElementID
* @param {object} coordinates
* @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.z The translation in direction of z-axis
* @param {object} rotation
* @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.z The rotation in degrees around the z-axis
* @return {boolean}
*/
var addElement = ( DOMElementID, coordinates, rotation ) => {
var addElement: Function = ( DOMElementID, coordinates, rotation ) => {
console.log( 'element added' );
return true;
};
/**
* Description
* @param {any} DOMElementID
* @return {any}
* 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
* @param {string} DOMElementID The element that is removed. Has to be the element ID of a DOM element
* @return {boolean}
*/
var removeElement = ( DOMElementID ) => {
var removeElement = ( DOMElementID: string ): boolean => {
return true;
};
/**
* Description
* @param {object} coordinates
* @param {object} rotation
* @returns {promise}
*/
var moveTo = ( coordinates: object, rotation: object ): Promise<any> => {
return new Promise( ( resolve, reject ) => {
} );
}
return {
init
};

8
tsconfig.json Normal file
View File

@@ -0,0 +1,8 @@
{
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "ES6"
},
"include": [ "./src/**/*" ]
}