是否可以在HTML Javascript中调用Typescript方法?

时间:2017-10-06 08:23:04

标签: javascript html typescript firebase-cloud-messaging

我正在运行Webprojekt whit FireBaseCloudMessaging。现在我必须在Typescript文件中调用一个方法来重新加载Notification上的消息。这可能吗?

HTML部分(index.html)

<script src="https://www.gstatic.com/firebasejs/4.3.0/firebase.js"></script>
<script>
    messaging.onMessage(function(payload) {
        console.log("Message received. ", payload);
        // ChatDialog.reloadMessages(); <-- Here i have to call the Typescript Method
    });
</script>

ChatDialog.ts

//This is the Method i have to call!
    reloadMessages(){
        this.messages.removeAll();
        localStorage.clear();
        ChatFunctions.getMessages(this, this.partner_id);
    }

0 个答案:

没有答案