diff --git a/scripts/build_declarations.sh b/scripts/build_declarations.sh
index dd2795bb..90aa81c7 100755
--- a/scripts/build_declarations.sh
+++ b/scripts/build_declarations.sh
@@ -12,6 +12,10 @@ function generate_link() {
fi
}
+function replace_tribble() {
+ #${1} => file name
+ echo "$(cat ${1} | sed -E 's/\/\/\/[ ]+.*/\n/')" > ${1}
+}
BASEDIR=$(dirname "$0")
cd "$BASEDIR/../"
@@ -21,10 +25,12 @@ cd "$BASEDIR/../"
#Web
execute_tsc -p web/tsconfig/tsdeclaration.json
+replace_tribble web/declarations/exports.d.ts
echo "Generated web declarations"
#Shared
execute_tsc -p shared/tsconfig/tsdeclaration.json
+replace_tribble shared/declarations/exports.d.ts
echo "Generated shared declarations"
#Now build the merged declaration for the shared project
diff --git a/shared/js/PPTListener.ts b/shared/js/PPTListener.ts
index 1a3b698c..e3e8f484 100644
--- a/shared/js/PPTListener.ts
+++ b/shared/js/PPTListener.ts
@@ -50,8 +50,9 @@ namespace ppt {
return result.substr(3);
}
+ /*
export declare function initialize() : Promise;
- export declare function finalize(); /* most the times not really required */
+ export declare function finalize(); // most the times not really required
export declare function register_key_listener(listener: (_: KeyEvent) => any);
export declare function unregister_key_listener(listener: (_: KeyEvent) => any);
@@ -60,4 +61,5 @@ namespace ppt {
export declare function unregister_key_hook(hook: KeyHook);
export declare function key_pressed(code: string | SpecialKey) : boolean;
+ */
}
\ No newline at end of file
diff --git a/shared/js/load.ts b/shared/js/load.ts
index 54d2d450..8d997400 100644
--- a/shared/js/load.ts
+++ b/shared/js/load.ts
@@ -52,6 +52,34 @@ namespace app {
}
}
+/* define that here */
+let impl_display_critical_error: (message: string) => any;
+
+interface Window {
+ impl_display_critical_error: (_: string) => any;
+}
+if(!window.impl_display_critical_error) { /* default impl */
+ impl_display_critical_error = message => {
+ if(typeof(createErrorModal) !== 'undefined') {
+ createErrorModal("A critical error occurred while loading the page!", message, {closeable: false}).open();
+ } else {
+ let tag = document.getElementById("critical-load");
+ let detail = tag.getElementsByClassName("detail")[0];
+ detail.innerHTML = message;
+
+ tag.style.display = "block";
+ }
+ fadeoutLoader();
+ }
+}
+function displayCriticalError(message: string) {
+ if(window.impl_display_critical_error)
+ window.impl_display_critical_error(message);
+ else
+ console.error("Could not display a critical message: " + message); /* this shall never happen! */
+}
+
+
function load_scripts(paths: (string | string[])[]) : {path: string, promise: Promise}[] {
let result = [];
for(let path of paths)
@@ -362,21 +390,6 @@ if(typeof Module === "undefined")
app.initialize();
app.loadedListener.push(fadeoutLoader);
-if(!window.displayCriticalError) { /* Declare this function here only because its required before load */
- window.displayCriticalError = function(message: string) {
- if(typeof(createErrorModal) !== 'undefined') {
- createErrorModal("A critical error occurred while loading the page!", message, {closeable: false}).open();
- } else {
- let tag = document.getElementById("critical-load");
- let detail = tag.getElementsByClassName("detail")[0];
- detail.innerHTML = message;
-
- tag.style.display = "block";
- }
- fadeoutLoader();
- }
-}
-
navigator.browserSpecs = (function(){
let ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
diff --git a/shared/js/main.ts b/shared/js/main.ts
index eb7be84a..0ec3fd80 100644
--- a/shared/js/main.ts
+++ b/shared/js/main.ts
@@ -8,7 +8,6 @@
///
///
///
-///
///
///
diff --git a/web/js/index.ts b/web/js/index.ts
index 32db6d6d..e69de29b 100644
--- a/web/js/index.ts
+++ b/web/js/index.ts
@@ -1,5 +0,0 @@
-interface Window {
- displayCriticalError: typeof displayCriticalError;
-}
-
-declare function displayCriticalError(message: string); /* fun fact: is implemented within loader.js, but only because we cant override that file */
\ No newline at end of file