mraid-type-definitions
v0.0.1
Published
TypeScript definitions for MRAID
Downloads
4
Maintainers
Readme
mraid-type-definitions
MRAID or “Mobile Rich Media Ad Interface Definitions” is a standard set by the IAB (Interactive Advertising Bureau) to mitigate advertisers headaches of in-app advertising caused by myriads of mobile devices running on different platforms (operating system).
This package is the type definition for MRAID. 🚀
Getting Started
# Clone the repository (you can also click "Use this template")
git clone https://github.com/sumn2u/mraid-type-definitions.git your_project_name
cd your_project_name
# Edit `package.json` and `tsconfig.json` to your liking
...
# Install dependencies
yarn install
# Now you can run various yarn commands:
yarn lint
yarn test
yarn build
yarn clean
yarn ts-node <filename>
...
Compiles and minifies build for production
yarn build
Tests with Jest
Tests can be written with Jest:
import {MRAID1, MRAID2, MRAID3 } from './main'
describe('MRAID Versions', () => {
const identity = (property: MRAID1| MRAID2 | MRAID3 ): MRAID1| MRAID2 | MRAID3 => property;
test('Should return mraid version', () => {
const testVersion: Partial<MRAID1> = { getVersion: jest.fn( () => "3.0")};
expect(identity(testVersion as MRAID1))
.toEqual(testVersion);
});
})
Run the tests with yarn test
, no separate compile step is necessary.
- See also the Jest documentation.
Usage
It can used as dependency by providing branch name or commit id after #
.
"mraid-type-definitions": "git+ssh://[email protected]/sumn2u/mraid-type-definitions.git#<branch_name or commit_id>"
References
- Mobile Rich Media Ad Interface Definition (MRAID)
- What is MRAID and How it Works for In-App Rich Media Mobile Advertising
- Blog post: Starting a TypeScript Project in 2021
- TypeScript Handbook
- tsconfig docs
- esbuild docs
- typescript-eslint docs
- Jest docs
- GitHub Actions, GitLab CI
Feedback
Reach out with feedback and ideas: