Skip to content

Commit

Permalink
Support for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
apvarun committed Feb 17, 2018
1 parent ca471f3 commit e82567a
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All the changes made to toastify-js library.

## [1.0.0] - 2018-02-17
- Support for modules

## [0.0.6] - 2017-09-09
- Support for changing background [Options]
- Optimized toast positioning logic
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 apvarun
Copyright (c) 2018 apvarun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion script.js → example/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Toastify({
destination: 'https://github.com/apvarun/toastify-js',
newWindow: true,
gravity: "top",
positionLeft: true
positionLeft: true,
}).showToast();

Toastify({
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="description" content="Toastify is a pure JavaScript library that lets you create notifications toasts/messages.">
<meta name="keywords" content="Javascript,Library,Toastify">
<meta name="author" content="apvarun">
<link rel="stylesheet" type="text/css" href="script.css">
<link rel="stylesheet" type="text/css" href="example/script.css">
<link rel="stylesheet" type="text/css" href="src/toastify.css">
</head>

Expand Down Expand Up @@ -42,7 +42,7 @@ <h2>Usage</h2>
</body>

<script type="text/javascript" src="src/toastify.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="example/script.js"></script>

<script>
(function (i, s, o, g, r, a, m) {
Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "toastify-js",
"version": "1.0.0",
"description": "Toastify is a lightweight, vanilla JS toast notification library.",
"main": "./src/toastify.js",
"repository": {
"type": "git",
"url": "git+https://github.com/apvarun/toastify-js.git"
},
"keywords": [
"toastify",
"javascript",
"notifications",
"toast"
],
"author": "Varun A P",
"license": "MIT",
"bugs": {
"url": "https://github.com/apvarun/toastify-js/issues"
},
"homepage": "https://github.com/apvarun/toastify-js#readme"
}
4 changes: 2 additions & 2 deletions src/toastify.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
* Toastify js 0.0.6
* Toastify js 1.0.0
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2017 Varun A P
* Copyright (C) 2018 Varun A P
*/
.toastify {
padding: 12px 20px;
Expand Down
22 changes: 15 additions & 7 deletions src/toastify.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/*!
* Toastify js 0.0.6
* Toastify js 1.0.0
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2017 Varun A P
* Copyright (C) 2018 Varun A P
*/
; (function (global) {
;
(function (root, factory) {
if(typeof module === "object" && module.exports) {
require('./toastify.css');
module.exports = factory();
} else {
root.Toastify = factory();
}
}(this, function (global) {

// Object initialization
var Toastify = function (options) {
Expand All @@ -14,7 +22,7 @@
return new Toastify.lib.init(options);
},
// Library version
version = "0.0.5";
version = "1.0.0";

// Defining the prototype of the object
Toastify.lib = Toastify.prototype = {
Expand Down Expand Up @@ -308,7 +316,7 @@
// Setting up the prototype for the init object
Toastify.lib.init.prototype = Toastify.lib;

// Adding the Toastify function to the window object
global.Toastify = Toastify;
// Returning the Toastify function to be assigned to the window object/module
return Toastify;

}(window));
}));

0 comments on commit e82567a

Please sign in to comment.