notibase-js
Advanced tools
Comparing version 0.1.2 to 0.1.3
25
index.ts
@@ -7,2 +7,8 @@ import * as signalR from '@microsoft/signalr'; | ||
} | ||
export interface NotificationModel { | ||
id: string; | ||
title: string; | ||
content: string; | ||
callback: string; | ||
} | ||
@@ -54,10 +60,15 @@ const baseUrl = 'https://api.notibase.com'; | ||
if (!targetElement) throw Error('Cannot find target element'); | ||
if (!connection) throw Error('Connection failed'); | ||
var div = document.createElement('div'); | ||
div.style.width = '100px'; | ||
div.style.height = '100px'; | ||
div.style.background = 'red'; | ||
div.style.color = 'white'; | ||
div.innerHTML = 'Hello'; | ||
targetElement.appendChild(div); | ||
connection.on('ReceiveNotification', (newNotifications: NotificationModel[]) => { | ||
newNotifications.map((notif) => { | ||
var div = document.createElement('div'); | ||
div.style.width = '100px'; | ||
div.style.height = '100px'; | ||
div.style.background = 'red'; | ||
div.style.color = 'white'; | ||
div.innerHTML = notif.title; | ||
targetElement.appendChild(div); | ||
}); | ||
}); | ||
} | ||
@@ -64,0 +75,0 @@ |
{ | ||
"name": "notibase-js", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Pure Javascript package to use Notibase", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6318
170