Skip to content

Commit

Permalink
put ignoreCache arg into an options object arg
Browse files Browse the repository at this point in the history
  • Loading branch information
themacguffinman committed Mar 15, 2022
1 parent 3504c8e commit 22816a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hot/style-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports.pitch = function (request) {
const updatePanelElems = require('panel/hot/update-panel-elems');
updatePanelElems('${elemName}', elem => {
if (elem.getConfig('useShadowDom')) {
elem.applyStaticStyle(newStyle.toString(), /* ignoreCache */ true);
elem.applyStaticStyle(newStyle.toString(), {ignoreCache: true});
return true;
}
});
Expand Down
4 changes: 2 additions & 2 deletions lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class Component extends WebComponent {

if (this.getConfig(`useShadowDom`)) {
this.el = this.attachShadow({mode: `open`});
this.applyStaticStyle(this.getConfig(`css`), /* ignoreCache */ false);
this.applyStaticStyle(this.getConfig(`css`));
} else if (this.getConfig(`css`)) {
throw Error(`"useShadowDom" config option must be set in order to use "css" config.`);
} else {
Expand Down Expand Up @@ -556,7 +556,7 @@ class Component extends WebComponent {
}
}

applyStaticStyle(styleSheetText, ignoreCache) {
applyStaticStyle(styleSheetText, {ignoreCache} = {ignoreCache: false}) {
if (styleSheetText) {
if (this.el.adoptedStyleSheets) {
// Attempt to cache the styles using Constructible StyleSheets if the feature is supported.
Expand Down
2 changes: 1 addition & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class Component<
styleOverrideTag?: Element;

/** Applies the static stylesheet for this component class */
applyStaticStyle(styleSheetText: null | string, ignoreCache: boolean): void;
applyStaticStyle(styleSheetText: null | string, options: {ignoreCache: boolean}): void;

/** Defines standard component configuration */
get config(): ConfigOptions<StateT, AppStateT, ContextRegistryT>;
Expand Down

0 comments on commit 22816a1

Please sign in to comment.