kvision / pl.treksoft.kvision.cordova

Package pl.treksoft.kvision.cordova

Kotlin bindings for core Apache Cordova API.

Types

Battery

object Battery

Main object for Cordova battery.

BatteryStatus

external class BatteryStatus

Battery status.

Browser

external class Browser

InAppBrowser reference object.

Camera

object Camera

Main object for Cordova camera.

CameraOptions

data class CameraOptions

Camera options.

Coordinates

external class Coordinates

Geolocation coordinates values.

CordovaEvent

enum class CordovaEvent

Cordova event types.

Device

external class Device

Device information class.

DirectoryEntry

external interface DirectoryEntry : Entry

DirectoryEntryCallback

external interface DirectoryEntryCallback

DirectoryEntrySync

external interface DirectoryEntrySync : EntrySync

DirectoryReader

external interface DirectoryReader

DirectoryReaderSync

external interface DirectoryReaderSync

EntriesCallback

external interface EntriesCallback

Entry

external interface Entry

EntryCallback

external interface EntryCallback

EntrySync

external interface EntrySync

ErrorCallback

external interface ErrorCallback

File

object File

Main object for Cordova file.

FileCallback

external interface FileCallback

FileEntry

external interface FileEntry : Entry

FileEntryCallback

external interface FileEntryCallback

FileEntrySync

external interface FileEntrySync : EntrySync

FileSaver

external interface FileSaver : EventTarget

FileSystem

external interface FileSystem

FileSystemCallback

external interface FileSystemCallback

FileSystemSync

external interface FileSystemSync

FileWriter

external interface FileWriter : FileSaver

FileWriterCallback

external interface FileWriterCallback

FileWriterSync

external interface FileWriterSync

Flags

external interface Flags

Geolocation

object Geolocation

Main geolocation object based on webview api.

InAppBrowser

object InAppBrowser

Main object for Cordova InAppBrowser api.

InAppBrowserEvent

external class InAppBrowserEvent

InAppBrowser event type.

LocalFileSystem

external object LocalFileSystem

LocalFileSystemSync

external object LocalFileSystemSync

Locationservices

object Locationservices

Main geolocation object based on Google location services api.

Media

external class Media

Cordova media class.

MediaCapture

object MediaCapture

Main media capture object.

MediaError

external class MediaError

Media error class.

MediaFile

external class MediaFile

Media file information class.

MediaFileData

external class MediaFileData

Media file details class.

Metadata

external interface Metadata

MetadataCallback

external interface MetadataCallback

Network

object Network

Main object for Cordova network.

Notification

object Notification

Main object for Cordova notifications.

PendingResult

external class PendingResult

Pending result class.

Position

external class Position

Geolocation position value.

PositionError

enum class PositionError

Geolocaton error codes.

PromptResponse

external class PromptResponse

A response object for prompt function callback.

Result

sealed class Result<out V : Any, out E>

ResumeEvent

external class ResumeEvent

Resume event class.

Screen

object Screen

Main object for Cordova screen.

Splashscreen

object Splashscreen

Main object for Cordova splashscreen.

StatusBar

object StatusBar

Main object for Cordova status bar.

SystemDirs

external class SystemDirs

System directories class.

Vibration

object Vibration

Main object for Cordova vibration.

VoidCallback

external interface VoidCallback

Exceptions

CameraException

class CameraException : Exception

Exception class for camera errors.

CaptureException

class CaptureException : Exception

Exception class for media capture errors.

FileException

class FileException : Exception

Exception class for file errors.

GeolocationException

class GeolocationException : Exception

Exception class for geolocation errors.

Extensions for External Classes

kotlin.String

Properties

cordovaDevice

var cordovaDevice: Device?

Cordova device information object.

Functions

addCordovaEventListener

fun addCordovaEventListener(event: CordovaEvent, listener: (Event) -> Unit): Unit

Add listeners for a Cordova events.

addDeviceReadyListener

fun addDeviceReadyListener(listener: (Device) -> Unit): Unit

Add listeners for 'deviceready' Cordova event.

addPauseListener

fun addPauseListener(listener: () -> Unit): Unit

Add listeners for 'pause' Cordova event.

addResumeListener

fun addResumeListener(listener: (ResumeEvent) -> Unit): Unit

Add listeners for 'resume' Cordova event.

any

fun <V : Any, E> Result<V, E>.any(predicate: (V) -> Boolean): Boolean

append

suspend fun FileEntry.append(data: <ERROR CLASS>): Result<FileEntry, FileException>

Append file content from a Blob.

suspend fun FileEntry.append(data: String): Result<FileEntry, FileException>

Append file content from a plain string.

copyTo

suspend fun Entry.copyTo(parent: DirectoryEntry, newName: String? = null): Result<Entry, FileException>

Copy given file or directory to a new location.

createWriter

suspend fun FileEntry.createWriter(): Result<FileWriter, FileException>

Create a FileWriter object for a given file entry.

failure

fun <E> Result<*, E>.failure(f: (E) -> Unit): Unit

fanout

fun <V : Any, U : Any> Result<V, *>.fanout(other: () -> Result<U, *>): Result<Pair<V, U>, *>

file

suspend fun FileEntry.file(): Result<File, FileException>

Get a File object for a given file entry.

flatMap

fun <V : Any, U : Any, E> Result<V, E>.flatMap(transform: (V) -> Result<U, E>): Result<U, E>

flatMapError

fun <V : Any, E, E2> Result<V, E>.flatMapError(transform: (E) -> Result<V, E2>): Result<V, E2>

getAs

fun <X> Result<*, *>.getAs(): X?

getCurrentAmplitude

suspend fun Media.getCurrentAmplitude(): Number

Returns the current amplitude within an audio file.

getCurrentPosition

suspend fun Media.getCurrentPosition(): Number

Returns the current position within an audio file.

getDevice

suspend fun getDevice(): Device

Suspending function to return device information object.

getDirectory

suspend fun DirectoryEntry.getDirectory(path: String, create: Boolean = true, exclusive: Boolean = false): Result<DirectoryEntry, FileException>

Get or create a directory in a given parent directory.

getFile

suspend fun DirectoryEntry.getFile(path: String, create: Boolean = true, exclusive: Boolean = false): Result<FileEntry, FileException>

Get or create a file in a given parent directory.

getFormatData

suspend fun MediaFile.getFormatData(): MediaFileData?

Get details for the given file.

getMetadata

suspend fun Entry.getMetadata(): Result<Metadata, FileException>

Get file or directory metadata.

getOrElse

infix fun <V : Any, E> Result<V, E>.getOrElse(fallback: V): V

getParent

suspend fun Entry.getParent(): Result<DirectoryEntry, FileException>

Get file or directory parent directory entry.

invoke

operator fun FileSystemCallback.invoke(filesystem: FileSystem): Unit
operator fun EntryCallback.invoke(entry: Entry): Unit
operator fun FileEntryCallback.invoke(entry: FileEntry): Unit
operator fun DirectoryEntryCallback.invoke(entry: DirectoryEntry): Unit
operator fun EntriesCallback.invoke(entries: Array<Entry>): Unit
operator fun MetadataCallback.invoke(metadata: Metadata): Unit
operator fun FileWriterCallback.invoke(fileWriter: FileWriter): Unit
operator fun FileCallback.invoke(file: File): Unit
operator fun VoidCallback.invoke(): Unit
operator fun ErrorCallback.invoke(err: Error): Unit

map

fun <V : Any, U : Any, E> Result<V, E>.map(transform: (V) -> U): Result<U, E>

mapError

fun <V : Any, E, E2> Result<V, E>.mapError(transform: (E) -> E2): Result<V, E2>

moveTo

suspend fun Entry.moveTo(parent: DirectoryEntry, newName: String? = null): Result<Entry, FileException>

Move given file or directory to a new location.

or

infix fun <V : Any, E> Result<V, E>.or(fallback: V): Result.Success<V>

readAsArrayBuffer

suspend fun FileEntry.readAsArrayBuffer(): Result<<ERROR CLASS>, FileException>

Read file content as an array buffer.

readAsDataURL

suspend fun FileEntry.readAsDataURL(): Result<String, FileException>

Read file content as a data url.

readAsText

suspend fun FileEntry.readAsText(): Result<String, FileException>

Read file content as a plain string.

readEntries

suspend fun DirectoryReader.readEntries(): Result<List<Entry>, FileException>

List directory entries for a given DirectoryReader.

suspend fun DirectoryEntry.readEntries(): Result<List<Entry>, FileException>

List directory entries for a given parent directory entry.

remove

suspend fun Entry.remove(): Result<Entry, FileException>

Remove given file or directory.

removeRecursively

suspend fun DirectoryEntry.removeRecursively(): Result<DirectoryEntry, FileException>

Remove given directory recursively.

success

fun <V : Any> Result<V, *>.success(f: (V) -> Unit): Unit

toBlob

fun <ERROR CLASS>.toBlob(): <ERROR CLASS>

Convert array buffer to a blob.

write

suspend fun FileEntry.write(data: <ERROR CLASS>): Result<FileEntry, FileException>

Write file content from a Blob.

suspend fun FileEntry.write(data: String): Result<FileEntry, FileException>

Write file content from a plain string.

writeDataUrL

suspend fun FileEntry.writeDataUrL(dataUrl: String): Result<FileEntry, FileException>

Write file content from a data url.