Engee 文档

纹理类型数组

StippleTypedArrays 是一个用于集成 Javascript TypedArrays 的 Stipple 插件。

典型用例是用于下载文件或通过二进制通道处理和发送信息的缓冲区。

StippleTypedArrays 引入了一个 Vector wrapper`TypedArray` ,可用于应用程序变量的类型声明。

注意事项

在后台,所有处理程序都能正常工作。但是,在客户端,JavaScript 无法观察类型数组,因此客户端缓冲区的任何变化都不会自动同步。

如果要将数据同步到服务器,必须在更新值后调用`this.push('data')` 。

演示应用程序

using Stipple, Stipple.ReactiveTools
using StippleUI

using StippleTypedArrays
using StippleDownloads

@app begin
    @in data = TypedArray(UInt8[])
    @in data64 = TypedArray(UInt64[])

    @in add_data = false
    @in clear_data = false

    @onbutton add_data begin
        x = rand(0:255)
        push!(data, x)
        notify(data)
        push!(data64, x + 1000)
        notify(data64)
    end

    @onbutton clear_data begin
        data = data64 = []
    end
end

@deps StippleTypedArrays

function ui()
    row(cell(class = "st-module q-ma-md", [

        row(class = "q-pa-md bg-green-2", "Data: [{{ data }}]")
        row(class = "q-pa-md q-my-lg bg-green-4", "Data64: [{{ data64 }}]")

        row([
            btn("Add data", icon = "add", @click(:add_data), color = "primary", nocaps = true)
            btn(class = "q-ml-lg", "Clear data", icon = "delete_forever", @click(:clear_data), color = "primary", nocaps = true)
        ])
    ]))
end

@page("/", ui)

up(open_browser = true)