mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
24 lines
544 B
Swift
24 lines
544 B
Swift
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import SwiftRs
|
|
import Tauri
|
|
import UIKit
|
|
import WebKit
|
|
|
|
class ExamplePlugin: Plugin {
|
|
@objc public func ping(_ invoke: Invoke) throws {
|
|
let onEvent = invoke.getChannel("onEvent")
|
|
onEvent?.send(["kind": "ping"])
|
|
|
|
let value = invoke.getString("value")
|
|
invoke.resolve(["value": value as Any])
|
|
}
|
|
}
|
|
|
|
@_cdecl("init_plugin_sample")
|
|
func initPlugin() -> Plugin {
|
|
return ExamplePlugin()
|
|
}
|