feat(rpc): inline selectors.register options in the protocol (#3072)

This commit is contained in:
Dmitry Gozman 2020-07-21 14:41:33 -07:00 committed by GitHub
parent 3dd61629e0
commit 18cb1c017a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 8 deletions

View File

@ -118,9 +118,7 @@ export interface SelectorsChannel extends Channel {
export type SelectorsRegisterParams = {
name: string,
source: string,
options: {
contentScript?: boolean,
},
contentScript?: boolean,
};
export type SelectorsRegisterResult = void;
export type SelectorsCreateSelectorParams = {

View File

@ -30,7 +30,7 @@ export class Selectors extends ChannelOwner<SelectorsChannel, SelectorsInitializ
async register(name: string, script: string | Function | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
const source = await helper.evaluationScript(script, undefined, false);
await this._channel.register({ name, source, options });
await this._channel.register({ ...options, name, source });
}
async _createSelector(name: string, handle: ElementHandle<Element>): Promise<string | undefined> {

View File

@ -108,8 +108,7 @@ interface Selectors
parameters
name: string
source: string
options: object
contentScript?: boolean
contentScript?: boolean
command createSelector
parameters

View File

@ -25,8 +25,8 @@ export class SelectorsDispatcher extends Dispatcher<Selectors, SelectorsInitiali
super(scope, selectors, 'selectors', {});
}
async register(params: { name: string, source: string, options: { contentScript?: boolean } }): Promise<void> {
await this._object.register(params.name, params.source, params.options);
async register(params: { name: string, source: string, contentScript?: boolean }): Promise<void> {
await this._object.register(params.name, params.source, params);
}
async createSelector(params: { name: string, handle: ElementHandleDispatcher }): Promise<{ value?: string }> {