SERIALIZE_TO_IPC_FN
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/core · Kind Constant
import { SERIALIZE_TO_IPC_FN } from '@netwiv/api/core';A key to be used to implement a special function on your types that define how your type should be serialized when passing across the IPC.
Members
Section titled “Members”anchor
Section titled “anchor”anchor(name: string): stringReturns an <a> HTML anchor element and sets the name attribute to the text value
Deprecated A legacy feature for browser compatibility
at(index: number): string | undefinedReturns a new String consisting of the single UTF-16 code unit located at the specified index.
big(): stringReturns a <big> HTML element
Deprecated A legacy feature for browser compatibility
blink(): stringReturns a <blink> HTML element
Deprecated A legacy feature for browser compatibility
bold(): stringReturns a <b> HTML element
Deprecated A legacy feature for browser compatibility
charAt
Section titled “charAt”charAt(pos: number): stringReturns the character at the specified index.
charCodeAt
Section titled “charCodeAt”charCodeAt(index: number): numberReturns the Unicode value of the character at the specified location.
codePointAt
Section titled “codePointAt”codePointAt(pos: number): number | undefinedReturns a nonnegative integer Number less than 1114112 (0x110000) that is the code point value of the UTF-16 encoded code point starting at the string element at position pos in the String resulting from converting this object to a String. If there is no element at that position, the result is undefined. If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
concat
Section titled “concat”concat(...strings: string[]): stringReturns a string that contains the concatenation of two or more strings.
endsWith
Section titled “endsWith”endsWith(searchString: string, endPosition?: number | undefined): booleanReturns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.
fixed(): stringReturns a <tt> HTML element
Deprecated A legacy feature for browser compatibility
fontcolor
Section titled “fontcolor”fontcolor(color: string): stringReturns a <font> HTML element and sets the color attribute value
Deprecated A legacy feature for browser compatibility
fontsize
Section titled “fontsize”fontsize(size: number): stringfontsize(size: string): stringReturns a <font> HTML element and sets the size attribute value
Deprecated A legacy feature for browser compatibility
includes
Section titled “includes”includes(searchString: string, position?: number | undefined): booleanReturns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.
indexOf
Section titled “indexOf”indexOf(searchString: string, position?: number | undefined): numberReturns the position of the first occurrence of a substring.
italics
Section titled “italics”italics(): stringReturns an <i> HTML element
Deprecated A legacy feature for browser compatibility
lastIndexOf
Section titled “lastIndexOf”lastIndexOf(searchString: string, position?: number | undefined): numberReturns the last occurrence of a substring in the string.
length
Section titled “length”readonly length: numberReturns the length of a String object.
link(url: string): stringReturns an <a> HTML element and sets the href attribute value
Deprecated A legacy feature for browser compatibility
localeCompare
Section titled “localeCompare”localeCompare(that: string): numberlocaleCompare(that: string, locales?: string | string[] | undefined, options?: CollatorOptions | undefined): numberlocaleCompare(that: string, locales?: LocalesArgument, options?: CollatorOptions | undefined): numberDetermines whether two strings are equivalent in the current locale. Determines whether two strings are equivalent in the current or specified locale.
match(regexp: string | RegExp): RegExpMatchArray | nullmatch(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | nullMatches a string with a regular expression, and returns an array containing the results of that search. Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.
matchAll
Section titled “matchAll”matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>Matches a string with a regular expression, and returns an iterable of matches containing the results of that search.
normalize
Section titled “normalize”normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): stringnormalize(form?: string | undefined): stringReturns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
padEnd
Section titled “padEnd”padEnd(maxLength: number, fillString?: string | undefined): stringPads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string.
padStart
Section titled “padStart”padStart(maxLength: number, fillString?: string | undefined): stringPads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the start (left) of the current string.
repeat
Section titled “repeat”repeat(count: number): stringReturns a String value that is made from count copies appended together. If count is 0, the empty string is returned.
replace
Section titled “replace”replace(searchValue: string | RegExp, replaceValue: string): stringreplace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]): string) => stringreplace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): stringreplace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]): string): string; }, replacer: (substring: string, ...args: any[]) => string) => stringReplaces text in a string, using a regular expression or search string.
Passes a string and {@linkcode replaceValue} to the [Symbol.replace] method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.
Replaces text in a string, using an object that supports replacement within a string.
replaceAll
Section titled “replaceAll”replaceAll(searchValue: string | RegExp, replaceValue: string): stringreplaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]): string) => stringReplace all instances of a substring in a string, using a regular expression or search string.
search
Section titled “search”search(regexp: string | RegExp): numbersearch(searcher: { [Symbol.search](string: string): number; }): numberFinds the first substring match in a regular expression search.
slice(start?: number | undefined, end?: number | undefined): stringReturns a section of a string.
small(): stringReturns a <small> HTML element
Deprecated A legacy feature for browser compatibility
split(separator: string | RegExp, limit?: number | undefined): string[]split(splitter: { [Symbol.split](string: string, limit?: number | undefined): string[]; }, limit?: number | undefined): string[]Split a string into substrings using the specified separator and return them as an array.
startsWith
Section titled “startsWith”startsWith(searchString: string, position?: number | undefined): booleanReturns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.
strike
Section titled “strike”strike(): stringReturns a <strike> HTML element
Deprecated A legacy feature for browser compatibility
sub(): stringReturns a <sub> HTML element
Deprecated A legacy feature for browser compatibility
substr
Section titled “substr”substr(from: number, length?: number | undefined): stringGets a substring beginning at the specified location and having the specified length.
Deprecated A legacy feature for browser compatibility
substring
Section titled “substring”substring(start: number, end?: number | undefined): stringReturns the substring at the specified location within a String object.
sup(): stringReturns a <sup> HTML element
Deprecated A legacy feature for browser compatibility
toLocaleLowerCase
Section titled “toLocaleLowerCase”toLocaleLowerCase(locales?: string | string[] | undefined): stringtoLocaleLowerCase(locales?: LocalesArgument): stringConverts all alphabetic characters to lowercase, taking into account the host environment’s current locale.
toLocaleUpperCase
Section titled “toLocaleUpperCase”toLocaleUpperCase(locales?: string | string[] | undefined): stringtoLocaleUpperCase(locales?: LocalesArgument): stringReturns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment’s current locale.
toLowerCase
Section titled “toLowerCase”toLowerCase(): stringConverts all the alphabetic characters in a string to lowercase.
toString
Section titled “toString”toString(): stringReturns a string representation of a string.
toUpperCase
Section titled “toUpperCase”toUpperCase(): stringConverts all the alphabetic characters in a string to uppercase.
trim(): stringRemoves the leading and trailing white space and line terminator characters from a string.
trimEnd
Section titled “trimEnd”trimEnd(): stringRemoves the trailing white space and line terminator characters from a string.
trimLeft
Section titled “trimLeft”trimLeft(): stringRemoves the leading white space and line terminator characters from a string.
Deprecated A legacy feature for browser compatibility. Use trimStart instead
trimRight
Section titled “trimRight”trimRight(): stringRemoves the trailing white space and line terminator characters from a string.
Deprecated A legacy feature for browser compatibility. Use trimEnd instead
trimStart
Section titled “trimStart”trimStart(): stringRemoves the leading white space and line terminator characters from a string.
valueOf
Section titled “valueOf”valueOf(): stringReturns the primitive value of the specified object.
Example
Section titled “Example”Given a type in Rust that looks like this
#[derive(serde::Serialize, serde::Deserialize)enum UserId { String(String), Number(u32),}UserId::String("id") would be serialized into { String: "id" }
and so we need to pass the same structure back to Rust
import { SERIALIZE_TO_IPC_FN } from "@netwiv/api/core"
class UserIdString { id constructor(id) { this.id = id }
[SERIALIZE_TO_IPC_FN]() { return { String: this.id } }}
class UserIdNumber { id constructor(id) { this.id = id }
[SERIALIZE_TO_IPC_FN]() { return { Number: this.id } }}
type UserId = UserIdString | UserIdNumberDescriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.