From cad6f6c8c9e95425063120a1d60b3fa6b7fd1ac3 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Sat, 11 Sep 2021 09:23:13 +0800 Subject: [PATCH] modify d.ts Signed-off-by: lifansheng --- api/phone/@ohos.process.d.ts | 34 ++--- api/phone/@ohos.url.d.ts | 245 +++++++++++++++++------------------ 2 files changed, 138 insertions(+), 141 deletions(-) diff --git a/api/phone/@ohos.process.d.ts b/api/phone/@ohos.process.d.ts index c22bb47950..3f690ab00c 100755 --- a/api/phone/@ohos.process.d.ts +++ b/api/phone/@ohos.process.d.ts @@ -37,15 +37,14 @@ declare namespace process { /** * send a signal to process */ - kill(signo: number): void; + kill(signal: number | string): void; } + type EventListener = (evt: Object) => void; /** * spawns a new ChildProcess to run the command */ - function runCmd(command: string, options?: RunOptions): ChildProcess; - - function getPid(): number; - function getPpid(): number; + function runCmd(command: string, + options?: { timeout : number, killSignal : number | string, maxBuffer : number }): ChildProcess; /** *abort current process @@ -54,28 +53,31 @@ declare namespace process { function abort(): void; function on(type: string, listener: EventListener): void; - function exit(code:number): void; - + function off(type: string): boolean; + function exit(code: number): void; /** *get current work directory; */ function cwd(): string; - + /** *change current directory *@param dir */ function chdir(dir: string): void; - function getEgid(): number; - function getEuid(): number; - - function getGid(): number; - function getUid(): number; function uptime(): number; - - function getGroups(): number[]; + /** + * send some signal to target process + */ function kill(signal: number, pid: number): boolean; - function off(type: string): boolean; + + readonly getEgid: number; + readonly getEuid: number; + readonly getGid: number; + readonly getUid: number; + readonly getGroups: number[]; + readonly getPid: number; + readonly getPpid: number; } export default process; \ No newline at end of file diff --git a/api/phone/@ohos.url.d.ts b/api/phone/@ohos.url.d.ts index c89206f5d3..78296ef60b 100755 --- a/api/phone/@ohos.url.d.ts +++ b/api/phone/@ohos.url.d.ts @@ -1,125 +1,120 @@ -/* -* Copyright (c) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -declare class URLSearchParams { - constructor(init ? : string[][] | Record | string | URLSearchParams -}; - -/** Appends a specified key/value pair as a new search parameter. - */ -append(name: string, value : string) : void; - -/** Delete the given search parameter and its associated value, - * from the list of all search parameters. - */ -delete(name: string) : void; - -/** Returns all the values associated with a given search parameter - * as an array. - */ -getAll(name: string) : string[]; - -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -entries() : IterableIterator<[string, string]>; - -/** Allows iteration through all values contained in this object via a callback function. - */ -forEach(callbackfn: (value: string, key : string, parent : this) = > void, thisArg ? : object) : void; - -/** Returns the first value associated to the given search parameter. - */ -get(name: string) : string | null; - -/** Returns a Boolean that indicates whether a parameter with the - * specified name exists. - */ -has(name: string) : boolean; - -/**Sets the value associated with a given search parameter to the - * given value.If there were several matching values, this methods - * deletes the others. If the search parameter doesn't exist, this - * methods creates it. - */ -set(name: string, value : string) : void; - -/** Sort all key/value pairs contained in this object in place and - * return undefined. - */ -sort() : void; - -/** Returns an iterator allowing to go through all keys contained - * in this object. - */ -keys() :IterableIterator; - -/** Returns an iterator allowing to go through all values contained - * in this object. - */ -values() : IterableIterator; - - -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -[Symbol.iterator]() : IterableIterator<[string, string]>; - -/** Returns a query string suitable for use in a URL. - */ -toString() :string; -} - -/* web api URL interface */ -declare class URL { - /** constructor of URL - * url:absolute URL string or a relative URL string - * base:base URL string - */ - constructor(url: string, base ? : string | URL); - - /* methods */ - createObjectURL(object: object) : string; - revokeObjectURL(url: string) : void; - toString() : string; - toJSON() : string; - - /* fragment identifier of URL */ -hash: string; - /* domain: port of URL */ -host: string; - /* domain of URL */ -hostname: string; - /* whole URL */ -href: string; - /* contain the origin of the URL, readonly */ - readonly origin : string; - /* password specified before the domain name */ -password: string; - /* an '/' followed by the path of the URL */ -pathname: string; - /* port of the URL */ -port: string; - /* the protocol scheme of the URL, readonly */ -protocol: string; - /* indicating the parameter string of the URL */ -search: string; - /* URLSearchParams object which used to access the individual query parameters */ - readonly searchParams : URLSearchParams; - /* the username before the domain name */ -username: string; -} - -export {URL, URLSearchParams}; \ No newline at end of file +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +declare namespace url { + class URLSearchParams { + constructor(init?: string[][] | Record | string | URLSearchParams); + /* + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + + /** Deletes the given search parameter and its associated value, + * from the list of all search parameters. + */ + delete(name: string): void; + + /** Returns all the values associated with a given search parameter + * as an array. + */ + getAll(name: string): string[]; + + /** Returns an iterator allowing to go through all key/value + * pairs contained in this object. + */ + entries(): IterableIterator<[string, string]>; + /** Allows iteration through all values contained in this object via a callback function. + */ + forEach(callbackfn: (value: string, key: string, parent: this) => void, thisArg?: Object): void; + + /** Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + + /** Returns a Boolean that indicates whether a parameter with the + * specified name exists. + */ + has(name: string): boolean; + + /** Sets the value associated with a given search parameter to the + * given value. If there were several matching values, this method + * deletes the others. If the search parameter doesn't exist, this + * method creates it. + */ + set(name: string, value: string): void; + /** Sort all key/value pairs contained in this object in place and + * return undefined. + */ + sort(): void; + + /** Returns an iterator allowing to go through all keys contained + * in this object. + */ + keys(): IterableIterator; + + /** Returns an iterator allowing to go through all values contained + * in this object. + */ + values(): IterableIterator; + + /** Returns an iterator allowing to go through all key/value + * pairs contained in this object. + */ + [Symbol.iterator](): IterableIterator<[string, string]>; + + /* + * Returns a query string suitable for use in a URL. + */ + toString(): string; + } + /* web api URL interface */ + class URL { + /** constructor of URL + * url: absolute URL string or a relative URL string + * base: base URL string + */ + constructor(url: string, base?: string | URL); + + /* methods */ + toString(): string; + toJSON(): string; + + /* fragment identifier of URL */ + hash: string; + /* domain:port of URL */ + host: string; + /* domain of URL */ + hostname: string; + /* whole URL */ + href: string; + /* contain the origin of the URL, readonly */ + readonly origin: string; + /* password specified before the domain name */ + password: string; + /* an '/' followed by the path of the URL */ + pathname: string; + /* port of the URL */ + port: string; + /* the protocol scheme of the URL */ + protocol: string; + /* indicating the parameter string of the URL */ + search: string; + /* URLSearchParams object which used to access the individual query parameters */ + readonly searchParams: URLSearchParams; + /* the username before the domain name */ + username: string; + } +} +export default url; \ No newline at end of file -- Gitee