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
/** | |
* Event Listeners and notifications module | |
*/ | |
var simpleMVC = (function simpleMVC(simple) { | |
'use strict'; | |
// sender is the context of the Model or View which originates the event | |
simple._Event = function SimpleEvent(sender) { | |
this._sender = sender; | |
this._listeners = []; |
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="loa.js"></script> | |
</head> | |
<body> | |
<h1 id="fade-in-slow">Fade in slow</h1> | |
<h2 id="fade-out-slower">Fade out slower</h2> | |
<h3 id="fade-in-out">Fade in and out</32> | |
<script> |
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
/** | |
* Simple MVC, 2016 Todd Zebert | |
* Model module | |
*/ | |
var simpleMVC = (function simpleMVC(simple) { | |
'use strict'; | |
simple.Model = function SimpleModel(data) { | |
this._data = data; |
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
/** | |
* A 1-way View Module | |
*/ | |
var simpleMVC = (function simpleMVC(simple) { | |
'use strict'; | |
simple.OneWayView = function simpleOneWayView(model, selector) { | |
this._model = model; | |
this._selector = selector; |
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
/** | |
* A 2-way View Module | |
*/ | |
var simpleMVC = (function simpleMVC(simple) { | |
'use strict'; | |
// selector is a DOM element that supports .onChanged and .value | |
simple.TwoWayView = function simpleTwoWayView(model, selector) { | |
this._model = model; |
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
/** | |
* Controller module | |
*/ | |
var simpleMVC = (function simpleMVC(simple) { | |
'use strict'; | |
simple.Controller = function SimpleController(model, view) { | |
this._model = model; | |
this._view = view; |
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
@import "breakpoint"; | |
// loop through the map and add the breakpoints | |
@mixin add-bp($bps) { | |
@each $bp-name, $bp in $bps { | |
@include add-breakpoint($bp-name, $bp); | |
} | |
} | |
// loop through the map and set `content` |
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
// set our site's breakpoints | |
$site-breakpoints: ( | |
"small": 320px, | |
"medium": 460px, | |
"large": 969px, | |
"x-large": 1061px, | |
"xx-large": 1284px | |
); | |
@include add-bp($site-breakpoints); |
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
// see https://www.lullabot.com/articles/importing-css-breakpoints-into-javascript | |
// module pattern | |
var bpExport = (function (bpExport) { | |
// this will create a closure | |
bpExport.breakpoint = function(sel) { | |
// define private state | |
var state = null; |
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
$(function() { | |
bodyBP = bpExport.breakpoint('body'); | |
bodyBP.onChange(function(bp) { | |
$('.my-site-breakpoint').html(bp); | |
}); | |
myDivBP = bpExport.breakpoint('.my-div'); | |
myDivBP.onChange(function(bp) { | |
$('.my-div-breakpoint').html(bp); |
OlderNewer