Skip to content

Commit

Permalink
Remove logs in window if!
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Nov 18, 2023
1 parent 84eb643 commit f81ecd5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
32 changes: 31 additions & 1 deletion network/communication-interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
import { Endpoint } from "../types/addressing.ts";

/**
* Base class for all DATEX communication interfaces
*/
export abstract class CommunicationInterface {
//TODO:

abstract name: string
abstract description?: string

/**
* Can send data
*/
abstract canSend: boolean

/**
* Can receive data
*/
abstract canReceive: boolean

/**
* Has a connection to the supranet, use as a default interface if possible
*/
abstract isGlobal: boolean //


/**
* Send a DATEX block via this interface
* @param datex
* @param to
*/
public send(datex:ArrayBuffer, to?: Endpoint) {

}

}
4 changes: 0 additions & 4 deletions windows/window-com-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class WindowCommunicationInterface extends CommonInterface<[Window, strin

protected async connect() {
// is the parent document
console.log("iinit", this.initial_arguments)
if (this.initial_arguments[0] !== self.window.opener) {
this.window = this.initial_arguments[0];
this.otherOrigin = this.initial_arguments[1];
Expand All @@ -40,7 +39,6 @@ export class WindowCommunicationInterface extends CommonInterface<[Window, strin
}
globalThis.addEventListener("message", this.onReceive);
// if in sub window: send INIT to parent immediately
console.log("SEND sendInit", this.parentDocument)
if (this.parentDocument)
this.sendInit();

Expand All @@ -56,7 +54,6 @@ export class WindowCommunicationInterface extends CommonInterface<[Window, strin
}

else if (data?.type == "INIT") {
console.warn(" && !this.endpoint", !this.endpoint)
this.endpoint = Target.get(data.endpoint) as Datex.Endpoint;

// if in parent: send INIT to window after initialized
Expand All @@ -66,7 +63,6 @@ export class WindowCommunicationInterface extends CommonInterface<[Window, strin
}

private sendInit() {
console.log("SEND sendInit...")
this.other.postMessage({
type:"INIT",
endpoint:Datex.Runtime.endpoint.toString()
Expand Down

0 comments on commit f81ecd5

Please sign in to comment.