Helpers for Progressive Windows Apps running on Windows
Перейти к файлу
Michael Hawker MSFT (XAML Llama) 1a7560da85
Update readme for project archival
2020-07-08 15:08:23 -07:00
dist General Cleanup & Update for testing 2019-01-24 14:33:52 -08:00
images Big update, added options from update tile to pin tile, new test UI. 2018-12-07 13:00:27 -08:00
lib General Cleanup & Update for testing 2019-01-24 14:33:52 -08:00
src Updated all buttons 2019-01-24 15:22:47 -08:00
.gitattributes Updated fields 2018-12-10 10:30:31 -08:00
.gitignore Fixed Timeline and updated settings 2018-12-17 13:19:15 -08:00
LICENSE Create LICENSE 2019-01-24 14:39:33 -08:00
README.md Update readme for project archival 2020-07-08 15:08:23 -07:00
index.html fix unpin Id 2019-01-24 15:26:32 -08:00
manifest.json Total rework 2018-12-04 09:58:02 -08:00
package-lock.json Audit Fix. 2019-09-06 08:26:53 -07:00
package.json General Cleanup & Update for testing 2019-01-24 14:33:52 -08:00
tsconfig.json moving to webpack 2019-01-22 13:38:15 -08:00
webpack.config.js General Cleanup & Update for testing 2019-01-24 14:33:52 -08:00

README.md

This project is discontinued

We no longer recommend using WinRT calls from JavaScript. Development focus is currently on the Chromium based engine for the Edge browser and Progressive Web App technology. Some of the features presented here are/will be replaced by a common standard API.

Please have a look at the PWA Builder components page to learn more about this new approach and for new code using standardized API calls.

Helpers for Progressive Web Apps running on Windows

Github

  • Download pwa.js from dist folder and add to your project

NPM: https://www.npmjs.com/package/ts-pwaapi

  • From the command line, run npm i ts-pwaapi

Example Importing the library:

import * as pwa from './pwa.js'

Functions:

createSecondaryTile(tileId, options)

Options group includes title, activationArguments, logoUri, foregroundText, backgroundColorWin, and backgroundColor{a,r,g,b}

Example:

pwa.createSecondaryTile(12345,{
    title: SecondaryTile,
    activationArguments: Args,
    logoUri: URI,
    foregroundText: light,
    backgroundColorWin: '',
    backgroundColor: {a: 255, r: 255, g: 255, b: 255}
    })

updateSecondaryTile(tileId, options)

Options group includes displayName, showNameOnSquare, foregroundText, squareMedUri, backgroundColorWin, and backgroundColor{a,r,g,b}

Example:

pwa.updateSecondaryTile(12345,{
    displayName: SecondaryTile,
    showNameOnSquare: 1, 
    foregroundText: light, 
    backgroundColorWin: '', 
    backgroundColor: {a: 255, r: 255, g: 255, b: 255}
    })n

removeSecondaryTile(tileId)

Unpins secondary tile from the start menu.
Example:

pwa.removeSecondaryTile(12345)

checkForDarkTheme()

Returns true or false if system theme is dark
Example:

let isDarkTheme = pwa.checkForDarkTheme();

changeAppTitleBarColor(colorOptions)

Options group includes backgroundColor, foregroundColor, buttonBackgroundColor, buttonForegroundColor, buttonHoverBackgroundColor, buttonHoverForegroundColor, buttonPressedBackgroundColor, buttonPressedForegroundColor, inactiveBackgroundColor, inactiveForegroundColor, buttonInactiveBackgroundColor, buttonInactiveForegroundColor.
All use {a,r,g,b} settings that accept 0-255 decimal or 0x## hexadecimal

Example:

pwa.changeAppTitleBarColor({
    backgroundColor: {a: 255,r: 100,g: 200,b: 225},
    foregroundColor: {a: 255,r: 125,g: 225,b: 250},
    inactiveBackgroundColor: {a: 100,r: 100,g: 200,b: 225},
    inactiveForegroundColor: {a: 100,r: 125,g: 225,b: 250}  
})

toggleCompactOverlayMode()

toggle window between default and shrunken overlay
Example:

pwa.toggleCompactOverlayMode()

addTimelineActivity(options)

Options group includes id, title, bodytext, imagepath, and activationUri.
Example:

pwa.addTimelineActivity({
    id: 12345,
    title: 'Title!',
    bodytext: 'Information!',
    imagepath: 'Uri',
    activationUri: 'Uri'
})

changeDesktopBackgroundImage(localImagePath)

Change desktop background to provided image
Example:

pwa.changeDesktopBackgroundImage('Uri')