Skip to content

Commit

Permalink
Update references to changed papi namespaces (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfheij-sil authored Nov 21, 2023
2 parents 5a0600a + 50cada0 commit ddb3046
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/extension-template-html.web-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
logger.info(input);
}

const dataProviderPromise = papi.dataProvider.get('helloSomeone.people');
const dataProviderPromise = papi.dataProviders.get('helloSomeone.people');

async function setupWebView() {
const peopleDataProvider = await dataProviderPromise;
Expand All @@ -54,7 +54,7 @@
const nameInput = document.getElementById('name-input');
const greeting = await peopleDataProvider.getGreeting(nameInput.value.toLowerCase());
const helloSomeoneOutput = document.getElementById('greetings-button-output');
helloSomeoneOutput.textContent = papi.util.htmlEncode(greeting || '');
helloSomeoneOutput.textContent = papi.utils.htmlEncode(greeting || '');
print(greeting);
});
greetingsButton.addEventListener('contextmenu', async (e) => {
Expand All @@ -73,7 +73,7 @@
const nameInput = document.getElementById('name-input');
const success = await peopleDataProvider.deletePerson(nameInput.value.toLowerCase());
const helloSomeoneOutput = document.getElementById('greetings-button-output');
helloSomeoneOutput.textContent = papi.util.htmlEncode(
helloSomeoneOutput.textContent = papi.utils.htmlEncode(
`${success ? 'Successfully' : 'Unsuccessfully'} deleted ${nameInput.value}.${
success ? ' RIP ⚰️' : ''
}`.replace(/'/g, '`'),
Expand All @@ -91,7 +91,7 @@
setGreetingsInput.value,
);
const helloSomeoneOutput = document.getElementById('greetings-button-output');
helloSomeoneOutput.textContent = papi.util.htmlEncode(
helloSomeoneOutput.textContent = papi.utils.htmlEncode(
`${success ? 'Successfully' : 'Unsuccessfully'} set ${name}'s greeting!`.replace(
/'/g,
'`',
Expand All @@ -110,7 +110,7 @@
parseInt(setAgeInput.value),
);
const helloSomeoneOutput = document.getElementById('greetings-button-output');
helloSomeoneOutput.textContent = papi.util.htmlEncode(
helloSomeoneOutput.textContent = papi.utils.htmlEncode(
`${success ? 'Successfully' : 'Unsuccessfully'} set ${name}'s age!`.replace(/'/g, '`'),
);
});
Expand All @@ -119,7 +119,7 @@
peopleDataProvider.subscribePeople(undefined, (people) => {
const peopleData = document.getElementById('people-data');
const peopleString = JSON.stringify(people, null, 2);
peopleData.textContent = papi.util.htmlEncode(peopleString.replace(/"/g, '`'));
peopleData.textContent = papi.utils.htmlEncode(peopleString.replace(/"/g, '`'));
print(peopleString);
});

Expand All @@ -130,7 +130,7 @@
() => {
peopleUpdateCount += 1;
const peopleUpdateCountDiv = document.getElementById('people-update-count');
peopleUpdateCountDiv.textContent = papi.util.htmlEncode(
peopleUpdateCountDiv.textContent = papi.utils.htmlEncode(
`People Updates: ${peopleUpdateCount}`,
);
},
Expand All @@ -146,7 +146,7 @@
const billAnyGreetingsUpdateCountDiv = document.getElementById(
'bill-any-greetings-update-count',
);
billAnyGreetingsUpdateCountDiv.textContent = papi.util.htmlEncode(
billAnyGreetingsUpdateCountDiv.textContent = papi.utils.htmlEncode(
`Any Greetings Updates (via Bill): ${billAnyGreetingsUpdateCount}`,
);
},
Expand All @@ -160,7 +160,7 @@
const billGreetingsUpdateCountDiv = document.getElementById(
'bill-greetings-update-count',
);
billGreetingsUpdateCountDiv.textContent = papi.util.htmlEncode(
billGreetingsUpdateCountDiv.textContent = papi.utils.htmlEncode(
`Bill Greetings Updates: ${billGreetingsUpdateCount}`,
);
});
Expand All @@ -172,7 +172,7 @@
() => {
billAnyAgeUpdateCount += 1;
const billAnyAgeUpdateCountDiv = document.getElementById('bill-any-age-update-count');
billAnyAgeUpdateCountDiv.textContent = papi.util.htmlEncode(
billAnyAgeUpdateCountDiv.textContent = papi.utils.htmlEncode(
`Any Age Updates (via Bill): ${billAnyAgeUpdateCount}`,
);
},
Expand All @@ -184,7 +184,7 @@
peopleDataProvider.subscribeAge('bIlL', () => {
billAgeUpdateCount += 1;
const billAgeUpdateCountDiv = document.getElementById('bill-age-update-count');
billAgeUpdateCountDiv.textContent = papi.util.htmlEncode(
billAgeUpdateCountDiv.textContent = papi.utils.htmlEncode(
`Bill Age Updates: ${billAgeUpdateCount}`,
);
});
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ logger.info('Extension template is importing!');
* - Pros
* - Can freely add properties and methods without specifying them in an extra type
* - Can use private methods (prefix with `#`) that are automatically ignored by papi
* - Can use @papi.dataProvider.decorators.ignore to tell papi to ignore methods
* - Can use @papi.dataProviders.decorators.ignore to tell papi to ignore methods
* - Can extend `DataProviderEngine` so TypeScript will understand you can call
* `this.notifyUpdate` without specifying a `notifyUpdate` function
* - Can easily create multiple data providers from the same engine if you have two independent
Expand Down Expand Up @@ -75,7 +75,7 @@ class QuickVerseDataProviderEngine
/** Latest updated verse reference */
latestVerseRef = 'JHN 11:35';

usfmDataProviderPromise = papi.dataProvider.get('usfm');
usfmDataProviderPromise = papi.dataProviders.get('usfm');

/** Number of times any verse has been modified by a user this session */
heresyCount = 0;
Expand All @@ -102,7 +102,7 @@ class QuickVerseDataProviderEngine
* as well. However, we added the `ignore` decorator, so papi will not pick it up. Alternatively,
* you can name it anything that doesn't start with `set` like `_setInternal` or `internalSet`.
*/
@papi.dataProvider.decorators.ignore
@papi.dataProviders.decorators.ignore
async setInternal(
selector: string,
data: ExtensionVerseSetData,
Expand Down Expand Up @@ -356,7 +356,7 @@ export async function activate(context: ExecutionActivationContext) {
}
engine.heresyCount = storedHeresyCount;

const quickVerseDataProviderPromise = papi.dataProvider.registerEngine(
const quickVerseDataProviderPromise = papi.dataProviders.registerEngine(
'paranextExtensionTemplate.quickVerse',
engine,
);
Expand Down

0 comments on commit ddb3046

Please sign in to comment.