You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
Merge pull request #180 from php-flasher/fix/issue-176
fix: Ensure global timeout setting applies to all requests
This commit is contained in:
@@ -7,7 +7,7 @@ import { AbstractPlugin } from './plugin'
|
||||
export default class FlasherPlugin extends AbstractPlugin {
|
||||
private theme: Theme
|
||||
private options = {
|
||||
timeout: 5000,
|
||||
timeout: null,
|
||||
timeouts: {
|
||||
success: 5000,
|
||||
info: 5000,
|
||||
@@ -31,7 +31,7 @@ export default class FlasherPlugin extends AbstractPlugin {
|
||||
const render = () =>
|
||||
envelopes.forEach((envelope) => {
|
||||
// @ts-expect-error
|
||||
const typeTimeout = this.options.timeouts[envelope.type] ?? this.options.timeout
|
||||
const typeTimeout = this.options.timeout ?? this.options.timeouts[envelope.type] ?? 5000;
|
||||
const options = {
|
||||
...this.options,
|
||||
...envelope.options,
|
||||
|
||||
+4
-4
@@ -80,7 +80,7 @@ class FlasherPlugin extends AbstractPlugin {
|
||||
constructor(theme) {
|
||||
super();
|
||||
this.options = {
|
||||
timeout: 5000,
|
||||
timeout: null,
|
||||
timeouts: {
|
||||
success: 5000,
|
||||
info: 5000,
|
||||
@@ -97,9 +97,9 @@ class FlasherPlugin extends AbstractPlugin {
|
||||
}
|
||||
renderEnvelopes(envelopes) {
|
||||
const render = () => envelopes.forEach((envelope) => {
|
||||
var _a, _b;
|
||||
const typeTimeout = (_a = this.options.timeouts[envelope.type]) !== null && _a !== void 0 ? _a : this.options.timeout;
|
||||
const options = Object.assign(Object.assign(Object.assign({}, this.options), envelope.options), { timeout: (_b = envelope.options.timeout) !== null && _b !== void 0 ? _b : typeTimeout });
|
||||
var _a, _b, _c;
|
||||
const typeTimeout = (_b = (_a = this.options.timeout) !== null && _a !== void 0 ? _a : this.options.timeouts[envelope.type]) !== null && _b !== void 0 ? _b : 5000;
|
||||
const options = Object.assign(Object.assign(Object.assign({}, this.options), envelope.options), { timeout: (_c = envelope.options.timeout) !== null && _c !== void 0 ? _c : typeTimeout });
|
||||
this.addToContainer(this.createContainer(options), envelope, options);
|
||||
});
|
||||
document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', render) : render();
|
||||
|
||||
Vendored
+4
-4
@@ -86,7 +86,7 @@
|
||||
constructor(theme) {
|
||||
super();
|
||||
this.options = {
|
||||
timeout: 5000,
|
||||
timeout: null,
|
||||
timeouts: {
|
||||
success: 5000,
|
||||
info: 5000,
|
||||
@@ -103,9 +103,9 @@
|
||||
}
|
||||
renderEnvelopes(envelopes) {
|
||||
const render = () => envelopes.forEach((envelope) => {
|
||||
var _a, _b;
|
||||
const typeTimeout = (_a = this.options.timeouts[envelope.type]) !== null && _a !== void 0 ? _a : this.options.timeout;
|
||||
const options = Object.assign(Object.assign(Object.assign({}, this.options), envelope.options), { timeout: (_b = envelope.options.timeout) !== null && _b !== void 0 ? _b : typeTimeout });
|
||||
var _a, _b, _c;
|
||||
const typeTimeout = (_b = (_a = this.options.timeout) !== null && _a !== void 0 ? _a : this.options.timeouts[envelope.type]) !== null && _b !== void 0 ? _b : 5000;
|
||||
const options = Object.assign(Object.assign(Object.assign({}, this.options), envelope.options), { timeout: (_c = envelope.options.timeout) !== null && _c !== void 0 ? _c : typeTimeout });
|
||||
this.addToContainer(this.createContainer(options), envelope, options);
|
||||
});
|
||||
document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', render) : render();
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user