deeplink

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 7 Imported by: 0

README

This library is used to create deep links for apps on Windows.

Usage

package main

import (
    "github.com/kaazedev/deeplink"
)

func main() {
    // Pass an scheme to the deeplink, and port for redirecting messages on already running app
    dl := deeplink.NewDeeplink("rocketapp", 5945)
	
    // Method to redirect messages to the app, this should be called before Register().
    dl.Prepare()
    
    // Register a scheme and set a callback function
    dl.Register(func(msg string) {
        println(msg)
    })
}

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeepLink struct {
	// Scheme is the name of the scheme to register, for example "myapp" will be accessible via "myapp://"
	Scheme string

	// Host is the host to listen on, used for checking is the app is already running
	Port uint

	// OnMessage is called when a message is received, the message is passed as a string
	OnMessage func(string)
}
func NewDeeplink(scheme string, port uint) *DeepLink

NewDeeplink creates a new DeepLink instance scheme is the name of the scheme to register, for example "myapp" will be accessible via "myapp://"

func (*DeepLink) Prepare

func (dl *DeepLink) Prepare()

Prepare prepares the DeepLink instance for receiving messages, this is required to redirect message to already running app

func (*DeepLink) Register

func (dl *DeepLink) Register(callback func(string)) (bool, error)

Register registers the scheme in the registry, this is required for the scheme to work

func (*DeepLink) Unregister

func (dl *DeepLink) Unregister() (bool, error)

Unregister unregisters the scheme from the registry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL