Created
March 22, 2017 15:09
-
-
Save marcveens/6542318e1882df92e9cce653c23ed591 to your computer and use it in GitHub Desktop.
Default JS plugin
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> | |
| <head> | |
| <script src="lodash.min.js"></script> | |
| </head> | |
| <body> | |
| <div class="js-player"></div> | |
| <script> | |
| ;(function () { | |
| 'use strict'; | |
| var DEFAULTS = { | |
| autoplay: true | |
| }; | |
| var VideoPlayer = function(root, options) { | |
| this.root = document.querySelector(arguments[0]); | |
| this.options = _.merge({}, DEFAULTS, _.isObject(arguments[1]) && arguments[1]); | |
| } | |
| VideoPlayer.prototype.play = function() { | |
| console.log('play', this); | |
| }; | |
| VideoPlayer.prototype.pause = function() { | |
| console.log('pause'); | |
| }; | |
| window.VideoPlayer = VideoPlayer; | |
| })(); | |
| var video = new VideoPlayer('.js-player'); | |
| video.play('video'); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment