-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typing improvements for io
and fixes for websocketclient
, and a few others
#1429
Open
cmidgley
wants to merge
21
commits into
Moddable-OpenSource:public
Choose a base branch
from
Intellisplash:io-typings
base: public
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+429
−173
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6bc4f6a
Start of io typings work
cmidgley f3c862b
Adjust namespace for 'config' to `websocketclient/config`
cmidgley e42b93c
Merge branch 'public' into io-typings
cmidgley 2fe80d7
Revert config.js
cmidgley 65d177e
Reverse webclient manfiest
cmidgley 201906a
Revert TLS include
cmidgley 9a3aa33
Define Device into global namespace to allow augmentation; have WebSo…
cmidgley afeb566
Removed unused import
cmidgley 04a118f
Fixed module imports to be within declare
cmidgley b6e275e
More refinements/improvements to tcp/udp/dns/websocket types
cmidgley 365854b
More io types, expanded webpage w/status and headers, fixed up 'this'…
cmidgley 72b162a
Add status codes to http/1.1 response
cmidgley 2d935cb
Fix bug with attach socket
cmidgley e002eab
Further type improvements for websocketclient
cmidgley a0c86df
Add onError error messages, don't use masks on server (attached socke…
cmidgley f88cff5
Fix bug with reversed client/server on mask
cmidgley b318fce
Switch builtin-global to builtin-device to be consistent with other t…
cmidgley 629663f
Remove unnecessary import
cmidgley 47168b1
Revert prior and apply new fix for attached sockets
cmidgley 876f4e0
Fix type of buffer on onControl
cmidgley 08e1cee
Small improvements on types
cmidgley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
Submodule test262
added at
0add42
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,51 +1,53 @@ | ||
/* | ||
* Copyright (c) 2022 Shinya Ishikawa | ||
* | ||
* This file is part of the Moddable SDK Tools. | ||
* | ||
* The Moddable SDK Tools is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Moddable SDK Tools is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
* Copyright (c) 2022 Shinya Ishikawa | ||
* | ||
* This file is part of the Moddable SDK Tools. | ||
* | ||
* The Moddable SDK Tools is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The Moddable SDK Tools is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
declare module "embedded:io/socket/tcp" { | ||
import type { Buffer } from "embedded:io/_common"; | ||
export type Options = ((({ | ||
address: string; | ||
} | { | ||
host: string; | ||
}) & { | ||
port: number; | ||
}) | { | ||
from: TCP; | ||
}) & { | ||
nodelay?: boolean; | ||
onReadable?: (this: TCP, bytes: number) => void; | ||
onWritable?: (this: TCP, bytes: number) => void; | ||
onError?: (this: TCP) => void; | ||
format?: "number" | "buffer"; | ||
target?: any; | ||
}; | ||
|
||
export default class TCP { | ||
constructor(options: Options) | ||
readonly remoteAddress: string | undefined; | ||
readonly remotePort: number | undefined; | ||
read(byteLength?: number): number | ArrayBuffer; | ||
read(buffer: Buffer): void; | ||
write(value: number | Buffer): void; | ||
close(): void; | ||
get format(): "number" | "buffer" | ||
set format(value: "number" | "buffer") | ||
} | ||
import type { Buffer } from "embedded:io/_common"; | ||
import type UDP from "embedded:io/socket/udp"; | ||
|
||
export type TCPOptions = (( | ||
{ | ||
address: string; | ||
port: number; | ||
} | { | ||
from: TCP; | ||
}) & { | ||
nodelay?: boolean; | ||
onReadable?: (this: TCP, bytes: number) => void; | ||
onWritable?: (this: TCP, bytes: number) => void; | ||
onError?: (this: TCP) => void; | ||
format?: "number" | "buffer"; | ||
} | ||
); | ||
|
||
export type TCPDevice = TCPOptions & { io: typeof UDP }; | ||
|
||
export default class TCP { | ||
constructor(options: TCPOptions); | ||
readonly remoteAddress: string | undefined; | ||
readonly remotePort: number | undefined; | ||
read(): number; | ||
read(byteLength: number): ArrayBuffer | undefined; | ||
read(buffer: Buffer): void; | ||
write(value: number | Buffer): void; | ||
close(): void; | ||
get format(): "number" | "buffer"; | ||
set format(value: "number" | "buffer"); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for filling this in. The change is good. I don't want even more copies of the HTTP status code map in the repo. I'll make a module for those so it can be shared. But that doesn't need to hold this up.