4.0.0 • Published 4 years ago

custom-banner-web-element v4.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

custom-banner-web-element

This code snippet creates a custom privacy banner element and was created as part of a university course.

Usage

As it is an npm package it can simply be importet with: npm install custom-banner-web-element

React

In a react application(typescript) just 1. create and declarations.d.ts file and add:

declare namespace JSX {
    interface IntrinsicElements {
        "custom-banner": any;
    }
}
  1. in your component:
import 'custom-banner-web-element'

...

//initialize an object reference 
const ref = createRef(); 

...

// add an event listener for whatever you want to do after accept is clicked 
const el: any = ref.current;
el.addEventListener('on-accept', () => {
    // callback function 
});

...

// render function in return staement(hooks)/render function with reference set from above 
<custom-banner 
          ref={ref} 
          application-name="Name"
          policy-link="Link">
</custom-banner>

Other frameworks

For the usage in other frameworks, pleace refer to specific instructions

4.0.0

4 years ago

3.0.0

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago