diff --git a/gh-pages/docs/apis/pjax/config/index.md b/gh-pages/docs/apis/pjax/config/index.md index bccdd63d..4d2f9f4e 100644 --- a/gh-pages/docs/apis/pjax/config/index.md +++ b/gh-pages/docs/apis/pjax/config/index.md @@ -65,7 +65,7 @@ Set a dictionary object having has/get/set/delete methods of Map to pass the doc ## fetch: {...} = ... -### rewrite: (url: string, method: string, headers: Headers, timeout: number, body: FormData | null) => XMLHttpRequest | undefined +### rewrite?: (url: string, method: string, headers: Headers, timeout: number, body: FormData | null) => XMLHttpRequest | undefined Rewrite the XHR object, or replace it with another or fake. @@ -79,7 +79,7 @@ Wait for the specified milliseconds after sending a request. ## update: {...} = ... -### rewrite: (url: string, document: Document, area: string, cache?: Document) => void = `() => undefined` +### rewrite?: (url: string, document: Document, area: string, cache?: Document) => void Rewrite the source document object. If you use the sequence option, you should use only it instead of this. diff --git a/src/layer/domain/data/config.test.ts b/src/layer/domain/data/config.test.ts index 4387e2bd..7ef47afa 100644 --- a/src/layer/domain/data/config.test.ts +++ b/src/layer/domain/data/config.test.ts @@ -18,7 +18,7 @@ describe('Unit: layer/domain/data/config', () => { it('ignore', () => { assert(new Config({}).update.ignore === '[href^="chrome-extension://"],[src*=".scr.kaspersky-labs.com/"]'); assert(new Config(new Config({})).update.ignore === '[href^="chrome-extension://"],[src*=".scr.kaspersky-labs.com/"]'); - assert(new Config({ update: { ignore: 'style' } }).update.ignore === '[href^="chrome-extension://"],[src*=".scr.kaspersky-labs.com/"],style'); + assert(new Config({ update: { ignore: 'style' } }).update.ignore === 'style,[href^="chrome-extension://"],[src*=".scr.kaspersky-labs.com/"]'); }); }); diff --git a/src/layer/domain/data/config.ts b/src/layer/domain/data/config.ts index 18170694..005af77a 100644 --- a/src/layer/domain/data/config.ts +++ b/src/layer/domain/data/config.ts @@ -8,26 +8,16 @@ export { scope } from './config/scope'; export class Config implements Option { constructor(option: Option) { - Object.defineProperties(this.update, { - ignore: { - enumerable: false, - set(this: Config['update'], value: string) { - this.ignores['_'] = value; - }, - get(this: Config['update']): string { - return Object.keys(this.ignores) - .map(i => this.ignores[i]) - .filter(s => s.trim().length > 0) - .join(','); - }, - }, - }); extend