Fixed build

This commit is contained in:
WolverinDEV 2019-07-06 16:04:18 +02:00
parent 0be22b6428
commit 5fdf5a5127
3 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,3 @@
declare const native: any; //FIXME: Read client declarations!
namespace connection {
export interface HandshakeIdentityHandler {
connection: AbstractServerConnection;
@ -68,8 +67,9 @@ namespace connection {
}
private handshake_finished(version?: string) {
if(native_client && window["native"] && native.client_version && !version) {
native.client_version()
const _native = window["native"];
if(native_client && _native && _native.client_version && !version) {
_native.client_version()
.then( this.handshake_finished.bind(this))
.catch(error => {
console.error(tr("Failed to get version:"));

View file

@ -3,9 +3,12 @@ declare function unescape(string: string): string;
declare class _sha1 {
static arrayBuffer($: ArrayBuffer) : ArrayBuffer;
}
/*
interface Window {
TextEncoder: any;
}
*/
namespace sha {
/*
@ -381,7 +384,7 @@ namespace sha {
})();
export function encode_text(buffer: string) : ArrayBuffer {
if (window.TextEncoder) {
if ((window as any).TextEncoder) {
return new TextEncoder().encode(buffer).buffer;
}
let utf8 = unescape(encodeURIComponent(buffer));

View file

@ -296,13 +296,13 @@ namespace Modals {
event.preventDefault();
spawn_context_menu(event.pageX, event.pageY, {
contextmenu.spawn_context_menu(event.pageX, event.pageY, {
name: "Edit",
type: MenuEntryType.ENTRY,
type: contextmenu.MenuEntryType.ENTRY,
callback: () => cb_edit(parseInt(element.attr("ban-id")))
}, {
name: "Delete",
type: MenuEntryType.ENTRY,
type: contextmenu.MenuEntryType.ENTRY,
callback: () => cb_delete(parseInt(element.attr("ban-id")))
});
};