use different global object name
This commit is contained in:
parent
c4c3b11baf
commit
68bb45b9a4
|
@ -4,7 +4,7 @@
|
|||
"es2020": true
|
||||
},
|
||||
"globals": {
|
||||
"SETTINGS": "readonly"
|
||||
"MOBILIZON_CONNECTOR": "readonly"
|
||||
},
|
||||
"parser": "@babel/eslint-parser",
|
||||
"extends": [
|
||||
|
|
|
@ -51,7 +51,7 @@ final class Mobilizon_Connector {
|
|||
'timeZone' => wp_timezone_string(),
|
||||
'url' => MobilizonConnector\Settings::getUrl()
|
||||
);
|
||||
wp_add_inline_script($scriptName, 'const SETTINGS = ' . json_encode($settings), 'before'); // TODO use different name
|
||||
wp_add_inline_script($scriptName, 'const MOBILIZON_CONNECTOR = ' . json_encode($settings), 'before');
|
||||
}
|
||||
|
||||
public function register_blocks() {
|
||||
|
|
|
@ -8,7 +8,7 @@ let document
|
|||
test.before(() => {
|
||||
const window = new JSDOM().window
|
||||
document = window.document
|
||||
window.SETTINGS = {
|
||||
window.MOBILIZON_CONNECTOR = {
|
||||
locale: 'en-GB',
|
||||
timeZone: 'utc',
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ export function clearEventsList(container) {
|
|||
export function displayEvents({ data, document, container }) {
|
||||
hideLoadingIndicator(container)
|
||||
|
||||
const isShortOffsetNameShown = SETTINGS.isShortOffsetNameShown
|
||||
const locale = SETTINGS.locale
|
||||
const isShortOffsetNameShown = MOBILIZON_CONNECTOR.isShortOffsetNameShown
|
||||
const locale = MOBILIZON_CONNECTOR.locale
|
||||
const maxEventsCount = container.getAttribute('data-maximum')
|
||||
const timeZone = SETTINGS.timeZone
|
||||
const timeZone = MOBILIZON_CONNECTOR.timeZone
|
||||
|
||||
const events = data.events
|
||||
? data.events.elements
|
||||
|
|
|
@ -19,7 +19,7 @@ function loadEventLists() {
|
|||
}
|
||||
|
||||
export function loadEventList(container) {
|
||||
const url = SETTINGS.url + URL_SUFFIX
|
||||
const url = MOBILIZON_CONNECTOR.url + URL_SUFFIX
|
||||
const limit = parseInt(container.getAttribute('data-maximum'))
|
||||
const groupName = container.getAttribute('data-group-name')
|
||||
clearEventsList(container)
|
||||
|
|
Loading…
Reference in New Issue