Permalink
Browse files

AMD support

  • Loading branch information...
tommoor committed Feb 10, 2014
2 parents 40cf574 + af1a41c commit 0c860eecb63386ace9df16cbfc7897da3c664b84
Showing with 83 additions and 3 deletions.
  1. +23 −0 README.md
  2. +17 −0 examples/index-amd.html
  3. +35 −0 examples/require.js
  4. +6 −1 tinycon.js
  5. +2 −2 tinycon.min.js
View
@@ -39,6 +39,29 @@ Tinycon.setOptions({
});
```
+### AMD support
+
+Tinycon can also be used as an asynchronous module.
+
+```javascript
+require([
+ 'tinycon.js'
+], function (T) {
+
+ T.setOptions({
+ width: 7,
+ height: 9,
+ font: '10px arial',
+ colour: '#ffffff',
+ background: '#549A2F',
+ fallback: true
+ });
+
+ T.setBubble(7);
+
+});
+```
+
## Browser Support
Tinycon has been tested to work completely in the following browsers. Older versions may be supported, but haven't been tested:
View
@@ -0,0 +1,17 @@
+<html>
+ <head>
+ <link rel="icon" href="favicon.ico">
+ <title>Tinycon</title>
+
+ <script src="require.js"></script>
+ <script>
+ require([
+ '../tinycon.min.js'
+ ], function (T) {
+ T.setBubble(3);
+ });
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -3,7 +3,7 @@
* Tom Moor, http://tommoor.com
* Copyright (c) 2012 Tom Moor
* @license MIT Licensed
- * @version 0.6.2
+ * @version 0.6.3
*/
(function(){
@@ -271,4 +271,9 @@
Tinycon.setOptions(defaults);
window.Tinycon = Tinycon;
+
+ if(typeof define === 'function' && define.amd) {
+ define(Tinycon);
+ }
+
})();
Oops, something went wrong.

0 comments on commit 0c860ee

Please sign in to comment.