Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work with ReactJs #15

Open
osaka911 opened this issue Jul 5, 2021 · 0 comments
Open

Not work with ReactJs #15

osaka911 opened this issue Jul 5, 2021 · 0 comments

Comments

@osaka911
Copy link

osaka911 commented Jul 5, 2021

Hi supporters,
I installed this newest library on my React Js project, but got a the error message:

Attempted import error: 'google' is not exported from '@alugha/ima'.

Here is my code:

`
import React, {Component} from "react";
import { loadImaSdk, google } from "@alugha/ima";

class AdsVideo extends Component<any, any> {
public readonly width = 320;
public readonly height = 180;

private adsManager: google.ima.AdsManager | undefined;
private adsLoader: google.ima.AdsLoader | undefined;
private adDisplayContainer: google.ima.AdDisplayContainer | undefined;
private videoContent: HTMLVideoElement | undefined;
private ima: any;

async componentDidMount() {
    try{
        this.ima = await loadImaSdk()
        this.initData(this.ima)
    } catch (e) {
        console.log("SDK could not be loaded. Check your ad blocker!")
    }
}


initData(ima: any) {
    this.videoContent = document.getElementById("ads-video--content-element") as HTMLVideoElement
    this.requestAds(ima)
}

}`

Dependencies:
"@alugha/ima": "^2.0.3",
"react": "^16.12.0",
"typescript": "^3.7.5",
...

Please check this issue. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant