Пишу скрипт показа сообщения
.Файл notify.js
:
;(function(){
function Notify(titleText, messageText) {
var notify = document.createElement("div");
notify.className = "notify";
var title = document.createElement("div");
title.className = "notify title";
title.innerHTML = titleText;
var message = document.createElement("div");
message.className = "notify message";
message.innerHTML = messageText;
notify.appendChild(title);
notify.appendChild(message);
function show(){
document.body.appendChild(notify);
}
}
})();
При подключении скрипта в index.html
и при вызове Notify("title","message").show()
ошибка Notify is not defined
и это понятно, но как по-другому писать, чтобы не было конфликтов с локальными скриптами?
Много ошибок допускаю, скажите, какие? Как правильно организовать код, писать библиотеку?