Skip to content

Commit

Permalink
feat(a2hs.js): new type definition (DefinitelyTyped#45502)
Browse files Browse the repository at this point in the history
- definition file
- tests

https://github.com/koddr/a2hs.js#readme

Thanks!
  • Loading branch information
peterblazejewicz authored Jun 16, 2020
1 parent 620f06b commit 1c238d7
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
16 changes: 16 additions & 0 deletions types/a2hs.js/a2hs.js-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import AddToHomeScreen = require('a2hs.js');

AddToHomeScreen();

AddToHomeScreen({
backgroundColor: 'red',
padding: '10px',
shadowColor: '#e9e9e9',
shadowSize: '10px',
color: '#5d5d5d',
brandName: 'Demo',
fontFamily: 'Tahoma, sans-serif',
fontSize: '0.9rem',
logoImage: `<svg enable-background="new 0 0 1952.00 734.93" height="25" viewBox="0 0 1952 734.93" width="70" xmlns="http://www.w3.org/2000/svg">`,
htmlContent: `Install <strong>{{brandName}} web app</strong> on your iOS device: tap share and <strong>Add to Home Screen</strong> ↓`,
});
65 changes: 65 additions & 0 deletions types/a2hs.js/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Type definitions for a2hs.js 0.4
// Project: https://github.io/koddr/a2hs.js
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
* A useful modern JavaScript solution for adding a progressive
* web application (PWA) to the home screen of your mobile
* iOS device.
*/
declare function AddToHomeScreen(settings?: AddToHomeScreen.Settings): void;

declare namespace AddToHomeScreen {
interface Settings {
/**
* Background color for container
* @default '#f9f9f9'
*/
backgroundColor?: string;
/**
* Padding for container
* @default '10px'
*/
padding?: string;
/**
* Shadow color for top of container
* @default '#e9e9e9'
*/
shadowColor?: string;
/**
* Shadow size for top of container
* @default '10px'
*/
shadowSize?: string;
/**
* Font family for content in container
* @default '-apple-system, sans-serif'
*/
fontFamily?: string;
/**
* Font color for content in container
* @default '#5d5d5d'
*/
color?: string;
/**
* Font size for content in container
* @default '0.9rem'
*/
fontSize?: string;
/**
* Brand for default `htmlContent`
* @default ''
*/
brandName?: string;
/**
* Logo for container
*/
logoImage?: string;
/**
* Content for container with HTML
*/
htmlContent?: string;
}
}
export = AddToHomeScreen;
23 changes: 23 additions & 0 deletions types/a2hs.js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"a2hs.js-tests.ts"
]
}
1 change: 1 addition & 0 deletions types/a2hs.js/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit 1c238d7

Please sign in to comment.