common

package
v0.0.0-...-da83fb2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalhostSecondServerURL is used when serving on localhost
	LocalhostSecondServerURL = "https://localhost:7900" // assumes you're using HTTPS
	// AppEngineSecondServerURL is used when serving on App Engine
	AppEngineSecondServerURL = "https://backend-dot-polyapp-open-source.appspot.com"
	// AppEngineEchoURL is used when serving on App Engine
	AppEngineEchoURL = "https://pwa.polyapp.tech"
	// AppEngineEchoURLAlt is used when testing with Google's appspot subdomains
	AppEngineEchoURLAlt = "https://polyapp-open-source.appspot.com"
	// LocalhostEchoURL is used when serving on localhost
	LocalhostEchoURL = "https://localhost"
)

Variables

This section is empty.

Functions

func ValidateString

func ValidateString(s string) error

Types

type MessageIncoming

type MessageIncoming struct {
	// MessageID identifies this message. This ensures 1 message gets 1 response.
	MessageID string `json:"MessageID"`
	// PageContext identifies what Page / View this is associated with globally
	PageContext string `json:"PageContext"`
	// ID which identifies what element in the Page / View this is associated with
	ID string `json:"ID"`
	// Data which is Type-specific
	Data string `json:"Data"`
}

func (MessageIncoming) Validate

func (message MessageIncoming) Validate() error

type MessageOutgoing

type MessageOutgoing struct {
	// MessageID is a randomly generated string. It's identical to MessageID on the incoming message.
	MessageID string
	// AddAjaxDOM are things we're putting in to the DOM.
	AddAjaxDOM []ModDOM
}

func HandleMessageIncoming

func HandleMessageIncoming(incomingMessage MessageIncoming) (MessageOutgoing, error)

func (MessageOutgoing) Validate

func (message MessageOutgoing) Validate() error

validate ensures the structure of MessageOutgoing is valid

type ModDOM

type ModDOM struct {
	// PageContext is the page where the InsertSelector is found
	PageContext string
	// DeleteSelector is all of the elements you're trying to remove
	DeleteSelector string
	// InsertSelector is the ID of the element we're inserting near
	InsertSelector string
	// Action is the position parameter in 'insertAdjacentHTML'
	Action string
	// HTML is what we are putting in to the DOM. It's the text parameter in 'insertAdjacentHTML'
	HTML string
}

ModDOM contains everything the client needs to modify the DOM with 'insertAdjacentHTML' function call.

Jump to

Keyboard shortcuts

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