forked from apache/daffodil-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06eb06b
commit 75e0fb1
Showing
4 changed files
with
93 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { ViewportDataResponse } from '@omega-edit/client' | ||
import { createViewport, modifyViewport } from '@omega-edit/client' | ||
|
||
export class Viewport { | ||
constructor( | ||
readonly id: string, | ||
protected data: Uint8Array, | ||
protected capacity: number | ||
protected capacity: number, | ||
public onDataUpdate: (viewport: Viewport) => void | ||
) {} | ||
length() { | ||
return this.data.length | ||
} | ||
setOffset(offset: number) { | ||
modifyViewport(this.id, offset, this.capacity).then((response) => { | ||
this.data = response.getData_asU8() | ||
this.onDataUpdate(this) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters