Skip to content

Commit 18cb1c0

Browse files
authored
feat(rpc): inline selectors.register options in the protocol (#3072)
1 parent 3dd6162 commit 18cb1c0

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

src/rpc/channels.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ export interface SelectorsChannel extends Channel {
118118
export type SelectorsRegisterParams = {
119119
name: string,
120120
source: string,
121-
options: {
122-
contentScript?: boolean,
123-
},
121+
contentScript?: boolean,
124122
};
125123
export type SelectorsRegisterResult = void;
126124
export type SelectorsCreateSelectorParams = {

src/rpc/client/selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class Selectors extends ChannelOwner<SelectorsChannel, SelectorsInitializ
3030

3131
async register(name: string, script: string | Function | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
3232
const source = await helper.evaluationScript(script, undefined, false);
33-
await this._channel.register({ name, source, options });
33+
await this._channel.register({ ...options, name, source });
3434
}
3535

3636
async _createSelector(name: string, handle: ElementHandle<Element>): Promise<string | undefined> {

src/rpc/protocol.pdl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ interface Selectors
108108
parameters
109109
name: string
110110
source: string
111-
options: object
112-
contentScript?: boolean
111+
contentScript?: boolean
113112

114113
command createSelector
115114
parameters

src/rpc/server/selectorsDispatcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export class SelectorsDispatcher extends Dispatcher<Selectors, SelectorsInitiali
2525
super(scope, selectors, 'selectors', {});
2626
}
2727

28-
async register(params: { name: string, source: string, options: { contentScript?: boolean } }): Promise<void> {
29-
await this._object.register(params.name, params.source, params.options);
28+
async register(params: { name: string, source: string, contentScript?: boolean }): Promise<void> {
29+
await this._object.register(params.name, params.source, params);
3030
}
3131

3232
async createSelector(params: { name: string, handle: ElementHandleDispatcher }): Promise<{ value?: string }> {

0 commit comments

Comments
 (0)