webusb api例子浏览器js操作usb设备

代码语言:html

所属分类:其他

代码描述:webusb api例子浏览器js操作usb设备,webusb还处理实验阶段,可以抢先体验下

代码标签: 浏览器 js 操作 usb 设备

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>

:root {
        --dust: #F1F1F2;
        --silver: #C2C2C2;
        --cobalt: #445780;
        --kelly-1: #67C28D;
        --kelly-2: #41A46B;
    }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background-color: var(--dust);
            box-sizing: border-box;
            font-family: 'Inter', 'helvetica neue', arial, sans-serif;
            height: 100%;
            margin: 0;
            padding: 0;
            position: relative;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
            width: 100%;
        }

        main {
            display: -webkit-box;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            flex-flow: column wrap;
            -webkit-box-pack: stretch;
            justify-content: stretch;
            -webkit-box-align: center;
            align-items: center;
            min-height: 100vh;
            width: 100%;
        }

        #instructions {
            padding: 2em;
            width: 100%;
        }
        #instructions h1 {
            margin: 0 0 .75em;
            font-size: 1.25em;
        }
        #instructions p {
            margin: 0 0 1em;
            font-size: .75em;
        }
        #instructions button {
            background-color: white;
            border: solid 1px var(--cobalt);
            border-radius: .25em;
            color: var(--cobalt);
            display: inline-block;
            font-size: 1em;
            margin: .5em .5em .65em;
            padding: .15em .35em;
            text-transform: uppercase;
        }

        section {
            box-sizing: border-box;
            width: 100%;
            display: -webkit-box;
            display: flex;
            -webkit-box-orient: horizontal;
            -webkit-box-direction: normal;
            flex-flow: row wrap;
            -webkit-box-pack: stretch;
            justify-content: stretch;
            -webkit-box-align: stretch;
            align-items: stretch;
            -webkit-box-flex: 1;
            flex: 1 1 auto;
        }

        .usb-status {
            width: 100%;
            -webkit-box-flex: 1;
            flex: 1 1 auto;
            display: -webkit-box;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            flex-flow: column wrap;
            -webkit-box-pack: center;
            justify-content: center;
            -webkit-box-align: center;
            align-items: center;
        }

        .usb-status--text {
            margin: 1em auto 0em;
            display: block;
            font-size: 1em;
            font-weight: 600;
            color: var(--cobalt);
            -webkit-box-ordinal-group: 3;
            order: 2;
            text-align: center;
            text-transform: uppercase;
        }

        .usb-status--icon {
            width: 10em;
            pointer-events: none;
            position: relative;
        }
        .usb-status--icon::before, .usb-status--icon::after {
            content: "";
            display: block;
            position: absolute;
            z-index: 1;
        }
        .usb-status--icon::before {
        .........完整代码请登录后点击上方下载按钮下载查看

网友评论0