-
-
Save tomasgregor/e4b57e42a0b4b0dd086e to your computer and use it in GitHub Desktop.
JS Factory Constructor Experiment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| adsfadsfsdfa | |
| <script id="jsbin-javascript"> | |
| AP = function() { | |
| var self = { | |
| el: $('body'), | |
| back: function() { | |
| this.el.css("background", "#affafa"); | |
| return self; | |
| }, | |
| bord: function() { | |
| this.el.css("border", "solid 1px"); | |
| this.color(); | |
| return self; | |
| }, | |
| color: function() { | |
| this.el.css("color", "red"); | |
| } | |
| }; | |
| return self; | |
| }; | |
| </script> | |
| <script id="jsbin-source-javascript" type="text/javascript">AP = function() { | |
| var self = { | |
| el: $('body'), | |
| back: function() { | |
| this.el.css("background", "#affafa"); | |
| return self; | |
| }, | |
| bord: function() { | |
| this.el.css("border", "solid 1px"); | |
| this.color(); | |
| return self; | |
| }, | |
| color: function() { | |
| this.el.css("color", "red"); | |
| } | |
| }; | |
| return self; | |
| }; | |
| </script></body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AP = function() { | |
| var self = { | |
| el: $('body'), | |
| back: function() { | |
| this.el.css("background", "#affafa"); | |
| return self; | |
| }, | |
| bord: function() { | |
| this.el.css("border", "solid 1px"); | |
| this.color(); | |
| return self; | |
| }, | |
| color: function() { | |
| this.el.css("color", "red"); | |
| } | |
| }; | |
| return self; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment