xshell 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chalk.browser.d.ts +2 -0
- package/chalk.browser.js +21 -0
- package/chalk.browser.js.map +1 -0
- package/net.browser.d.ts +23 -0
- package/net.browser.js +70 -0
- package/net.browser.js.map +1 -0
- package/package.json +1 -1
- package/prototype.browser.d.ts +130 -0
- package/prototype.browser.js +421 -0
- package/prototype.browser.js.map +1 -0
- package/toaster.browser.d.ts +9 -0
- package/toaster.browser.js +45 -0
- package/toaster.browser.js.map +1 -0
- package/tsconfig.json +0 -1
- package/utils.browser.d.ts +3 -0
- package/utils.browser.js +27 -0
- package/utils.browser.js.map +1 -0
- package/chalk.browser.ts +0 -41
- package/net.browser.ts +0 -141
- package/prototype.browser.ts +0 -728
- package/toaster.browser.ts +0 -50
- package/utils.browser.ts +0 -25
package/toaster.browser.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import './toaster.sass'
|
|
2
|
-
|
|
3
|
-
import { delay } from './utils.browser'
|
|
4
|
-
|
|
5
|
-
export let toaster = {
|
|
6
|
-
messages: [ ] as string[],
|
|
7
|
-
|
|
8
|
-
state: 'IDLE' as 'IDLE' | 'SHOW',
|
|
9
|
-
|
|
10
|
-
async toast (message: string) {
|
|
11
|
-
this.messages.push(message)
|
|
12
|
-
this.show()
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
async show () {
|
|
16
|
-
if (this.state === 'SHOW') return
|
|
17
|
-
this.state = 'SHOW'
|
|
18
|
-
|
|
19
|
-
let div = document.createElement('div')
|
|
20
|
-
div.className = 'toast'
|
|
21
|
-
document.body.appendChild(div)
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < this.messages.length; i++) {
|
|
24
|
-
const message = this.messages[i]
|
|
25
|
-
let span: HTMLSpanElement
|
|
26
|
-
if (i === 0) {
|
|
27
|
-
span = document.createElement('span')
|
|
28
|
-
span.className = 'text'
|
|
29
|
-
span.textContent = message
|
|
30
|
-
div.appendChild(span)
|
|
31
|
-
} else {
|
|
32
|
-
span = div.children[0] as HTMLSpanElement
|
|
33
|
-
span.textContent = message
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
div.classList.add('active')
|
|
37
|
-
await delay(2 * 1000)
|
|
38
|
-
div.classList.remove('active')
|
|
39
|
-
await delay(500)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
document.body.removeChild(div)
|
|
43
|
-
this.messages = [ ]
|
|
44
|
-
this.state = 'IDLE'
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const toast = toaster.toast.bind(toaster) as (typeof toaster)['toast']
|
|
49
|
-
|
|
50
|
-
export default toast
|
package/utils.browser.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export async function delay (milliseconds: number) {
|
|
2
|
-
return new Promise<void>( resolve => {
|
|
3
|
-
setTimeout(() => {
|
|
4
|
-
resolve()
|
|
5
|
-
}, milliseconds)
|
|
6
|
-
})
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** 拼接 TypedArrays 生成一个完整的 Uint8Array */
|
|
11
|
-
export function concat (arrays: ArrayBufferView[]) {
|
|
12
|
-
let length = 0
|
|
13
|
-
for (const a of arrays)
|
|
14
|
-
length += a.byteLength
|
|
15
|
-
|
|
16
|
-
let buf = new Uint8Array(length)
|
|
17
|
-
let offset = 0
|
|
18
|
-
for (const a of arrays) {
|
|
19
|
-
const uint8view = new Uint8Array(a.buffer, a.byteOffset, a.byteLength)
|
|
20
|
-
buf.set(uint8view, offset)
|
|
21
|
-
offset += uint8view.byteLength
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return buf
|
|
25
|
-
}
|