From 50cada054a20ebf52851e9a282b664197ab5e0a5 Mon Sep 17 00:00:00 2001 From: Rolf Heij Date: Mon, 20 Nov 2023 14:03:59 +0100 Subject: [PATCH] Update references --- src/extension-template-html.web-view.html | 22 +++++++++++----------- src/main.ts | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/extension-template-html.web-view.html b/src/extension-template-html.web-view.html index 1dece6c..5eb209f 100644 --- a/src/extension-template-html.web-view.html +++ b/src/extension-template-html.web-view.html @@ -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; @@ -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) => { @@ -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, '`'), @@ -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, '`', @@ -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, '`'), ); }); @@ -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); }); @@ -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}`, ); }, @@ -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}`, ); }, @@ -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}`, ); }); @@ -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}`, ); }, @@ -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}`, ); }); diff --git a/src/main.ts b/src/main.ts index d596dc5..a204bf9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 @@ -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; @@ -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, @@ -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, );