2016-04-04 21:31:15 -04:00
( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports : { } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ? n : e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 : [ function ( require , module , exports ) {
'use strict' ;
2016-05-18 23:12:36 -04:00
var _globals = require ( './utils/globals' ) ;
var _globals2 = _interopRequireDefault ( _globals ) ;
2016-04-04 21:31:15 -04:00
var _modules = require ( './modules' ) ;
var modules = _interopRequireWildcard ( _modules ) ;
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) newObj [ key ] = obj [ key ] ; } } newObj . default = obj ; return newObj ; } }
2016-05-18 23:12:36 -04:00
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
2016-07-14 14:41:30 -04:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } } /* jshint esnext: true */
2016-04-04 21:31:15 -04:00
var App = function ( ) {
2016-05-18 23:12:36 -04:00
function App ( ) {
2016-04-04 21:31:15 -04:00
_classCallCheck ( this , App ) ;
this . modules = modules ;
this . currentModules = [ ] ;
}
/ * *
* Execute global functions and settings
* @ return { Object }
* /
2016-07-14 14:41:30 -04:00
App . prototype . initGlobals = function initGlobals ( ) {
( 0 , _globals2 . default ) ( ) ;
return this ;
} ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
/ * *
* Find modules and initialize them
* @ return { Object } this Allows chaining
* /
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
App . prototype . initModules = function initModules ( ) {
// Elements with module
var moduleEls = document . querySelectorAll ( '[data-module]' ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Loop through elements
var i = 0 ;
var elsLen = moduleEls . length ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
for ( ; i < elsLen ; i ++ ) {
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Current element
var el = moduleEls [ i ] ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// All data- attributes considered as options
var options = this . getElemData ( el ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Add current DOM element and jQuery element
options . el = el ;
options . $el = $ ( el ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Module does exist at this point
var attr = options . module ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Splitting modules found in the data-attribute
var moduleIdents = attr . replace ( /\s/g , '' ) . split ( ',' ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Loop modules
var j = 0 ;
var modulesLen = moduleIdents . length ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
for ( ; j < modulesLen ; j ++ ) {
var moduleAttr = moduleIdents [ j ] ;
if ( typeof this . modules [ moduleAttr ] === 'function' ) {
var module = new this . modules [ moduleAttr ] ( options ) ;
this . currentModules . push ( module ) ;
2016-04-04 21:31:15 -04:00
}
}
}
2016-07-14 14:41:30 -04:00
return this ;
} ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
/ * *
* Get element data attributes
* @ param { DOMElement } el
* @ return { Array } data
* /
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
App . prototype . getElemData = function getElemData ( el ) {
// All attributes
var attributes = el . attributes ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Regex Pattern
var pattern = /^data\-(.+)$/ ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Output
var data = { } ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
for ( var i in attributes ) {
if ( ! attributes [ i ] ) {
continue ;
}
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
// Attributes name (ex: data-module)
var name = attributes [ i ] . name ;
// This happens.
if ( ! name ) {
continue ;
}
var match = name . match ( pattern ) ;
if ( ! match ) {
continue ;
2016-04-04 21:31:15 -04:00
}
2016-07-14 14:41:30 -04:00
// If this throws an error, you have some
// serious problems in your HTML.
data [ match [ 1 ] ] = el . getAttribute ( name ) ;
2016-04-04 21:31:15 -04:00
}
2016-07-14 14:41:30 -04:00
return data ;
} ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
/ * *
* Initialize app after document ready
* /
App . prototype . init = function init ( ) {
this . initGlobals ( ) . initModules ( ) ;
} ;
2016-04-04 21:31:15 -04:00
return App ;
} ( ) ;
$ ( function ( ) {
window . app = new App ( ) ;
window . app . init ( ) ;
} ) ;
2016-05-19 13:37:19 -04:00
} , { "./modules" : 3 , "./utils/globals" : 9 } ] , 2 : [ function ( require , module , exports ) {
2016-05-18 23:12:36 -04:00
"use strict" ;
2016-04-04 21:31:15 -04:00
Object . defineProperty ( exports , "__esModule" , {
2016-05-18 23:12:36 -04:00
value : true
2016-04-04 21:31:15 -04:00
} ) ;
2016-05-18 23:12:36 -04:00
exports . default = function ( ) {
svg4everybody ( ) ;
} ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
} , { } ] , 3 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
2016-04-04 21:31:15 -04:00
} ) ;
var _Button = require ( './modules/Button' ) ;
Object . defineProperty ( exports , 'Button' , {
enumerable : true ,
get : function get ( ) {
return _interopRequireDefault ( _Button ) . default ;
}
} ) ;
var _Title = require ( './modules/Title' ) ;
Object . defineProperty ( exports , 'Title' , {
enumerable : true ,
get : function get ( ) {
return _interopRequireDefault ( _Title ) . default ;
}
} ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
2016-05-18 23:12:36 -04:00
} , { "./modules/Button" : 5 , "./modules/Title" : 6 } ] , 4 : [ function ( require , module , exports ) {
2016-04-04 21:31:15 -04:00
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
2016-05-18 23:12:36 -04:00
var _environment = require ( '../utils/environment' ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:58:08 -04:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } } /* jshint esnext: true */
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
/ * *
* Abstract module
* Gives access to generic jQuery nodes
* /
2016-04-04 21:31:15 -04:00
2016-05-18 23:58:08 -04:00
var _class = function _class ( options ) {
_classCallCheck ( this , _class ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
this . $document = _environment . $document ;
this . $window = _environment . $window ;
this . $html = _environment . $html ;
this . $body = _environment . $body ;
this . $el = options . $el ;
2016-04-04 21:31:15 -04:00
} ;
2016-05-18 23:58:08 -04:00
exports . default = _class ;
2016-04-04 21:31:15 -04:00
2016-05-19 13:37:19 -04:00
} , { "../utils/environment" : 8 } ] , 5 : [ function ( require , module , exports ) {
2016-04-04 21:31:15 -04:00
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
2016-05-18 23:12:36 -04:00
var _AbstractModule2 = require ( './AbstractModule' ) ;
var _AbstractModule3 = _interopRequireDefault ( _AbstractModule2 ) ;
2016-04-04 21:31:15 -04:00
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
2016-05-18 23:12:36 -04:00
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; } /* jshint esnext: true */
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
var _class = function ( _AbstractModule ) {
_inherits ( _class , _AbstractModule ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
function _class ( options ) {
_classCallCheck ( this , _class ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
var _this = _possibleConstructorReturn ( this , _AbstractModule . call ( this , options ) ) ;
2016-04-04 21:31:15 -04:00
2016-05-19 13:37:19 -04:00
_this . $el . on ( 'click.Button' , function ( event ) {
_this . $document . trigger ( 'Title.changeLabel' , [ $ ( event . currentTarget ) . val ( ) ] ) ;
2016-05-18 23:12:36 -04:00
} ) ;
2016-04-04 21:31:15 -04:00
return _this ;
}
2016-07-14 14:41:30 -04:00
_class . prototype . destroy = function destroy ( ) {
this . $el . off ( '.Button' ) ;
} ;
2016-05-18 23:12:36 -04:00
return _class ;
} ( _AbstractModule3 . default ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
exports . default = _class ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
} , { "./AbstractModule" : 4 } ] , 6 : [ function ( require , module , exports ) {
2016-04-04 21:31:15 -04:00
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
2016-05-18 23:58:08 -04:00
var _visibility = require ( '../utils/visibility' ) ;
2016-05-18 23:12:36 -04:00
var _AbstractModule2 = require ( './AbstractModule' ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
var _AbstractModule3 = _interopRequireDefault ( _AbstractModule2 ) ;
2016-04-04 21:31:15 -04:00
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; } /* jshint esnext: true */
2016-05-18 23:12:36 -04:00
var _class = function ( _AbstractModule ) {
_inherits ( _class , _AbstractModule ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
function _class ( options ) {
_classCallCheck ( this , _class ) ;
2016-04-04 21:31:15 -04:00
2016-07-14 14:41:30 -04:00
var _this = _possibleConstructorReturn ( this , _AbstractModule . call ( this , options ) ) ;
2016-04-04 21:31:15 -04:00
_this . $label = _this . $el . find ( '.js-label' ) ;
2016-05-19 13:37:19 -04:00
_this . $document . on ( 'Title.changeLabel' , function ( event , value ) {
2016-04-04 21:31:15 -04:00
_this . changeLabel ( value ) ;
2016-05-19 13:37:19 -04:00
_this . destroy ( ) ;
2016-04-04 21:31:15 -04:00
} ) ;
2016-05-18 23:58:08 -04:00
2016-05-19 13:37:19 -04:00
_this . hiddenCallbackIdent = ( 0 , _visibility . visibilityApi ) ( {
action : 'addCallback' ,
state : 'hidden' ,
callback : _this . logHidden
} ) ;
_this . visibleCallbackIdent = ( 0 , _visibility . visibilityApi ) ( {
action : 'addCallback' ,
state : 'visible' ,
callback : _this . logVisible
} ) ;
2016-04-04 21:31:15 -04:00
return _this ;
}
2016-07-14 14:41:30 -04:00
_class . prototype . logHidden = function logHidden ( ) {
console . log ( 'Title is hidden' ) ;
} ;
_class . prototype . logVisible = function logVisible ( ) {
console . log ( 'Title is visible' ) ;
} ;
_class . prototype . changeLabel = function changeLabel ( value ) {
this . $label . text ( value ) ;
} ;
_class . prototype . destroy = function destroy ( ) {
this . $document . off ( 'Title.changeLabel' ) ;
( 0 , _visibility . visibilityApi ) ( {
action : 'removeCallback' ,
state : 'hidden' ,
ident : this . hiddenCallbackIdent
} ) ;
( 0 , _visibility . visibilityApi ) ( {
action : 'removeCallback' ,
state : 'visible' ,
ident : this . visibleCallbackIdent
} ) ;
this . $el . off ( '.Title' ) ;
} ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
return _class ;
} ( _AbstractModule3 . default ) ;
exports . default = _class ;
2016-05-19 13:37:19 -04:00
} , { "../utils/visibility" : 11 , "./AbstractModule" : 4 } ] , 7 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . addToArray = addToArray ;
exports . arrayContains = arrayContains ;
exports . arrayContentsMatch = arrayContentsMatch ;
exports . ensureArray = ensureArray ;
exports . lastItem = lastItem ;
exports . removeFromArray = removeFromArray ;
exports . toArray = toArray ;
exports . findByKeyValue = findByKeyValue ;
var _is = require ( './is' ) ;
function addToArray ( array , value ) {
var index = array . indexOf ( value ) ;
if ( index === - 1 ) {
array . push ( value ) ;
}
}
function arrayContains ( array , value ) {
for ( var i = 0 , c = array . length ; i < c ; i ++ ) {
if ( array [ i ] == value ) {
return true ;
}
}
return false ;
}
function arrayContentsMatch ( a , b ) {
var i ;
if ( ! ( 0 , _is . isArray ) ( a ) || ! ( 0 , _is . isArray ) ( b ) ) {
return false ;
}
if ( a . length !== b . length ) {
return false ;
}
i = a . length ;
while ( i -- ) {
if ( a [ i ] !== b [ i ] ) {
return false ;
}
}
return true ;
}
function ensureArray ( x ) {
if ( typeof x === 'string' ) {
return [ x ] ;
}
if ( x === undefined ) {
return [ ] ;
}
return x ;
}
function lastItem ( array ) {
return array [ array . length - 1 ] ;
}
function removeFromArray ( array , member ) {
if ( ! array ) {
return ;
}
var index = array . indexOf ( member ) ;
if ( index !== - 1 ) {
array . splice ( index , 1 ) ;
}
}
function toArray ( arrayLike ) {
var array = [ ] ,
i = arrayLike . length ;
while ( i -- ) {
array [ i ] = arrayLike [ i ] ;
}
return array ;
}
function findByKeyValue ( array , key , value ) {
return array . filter ( function ( obj ) {
return obj [ key ] === value ;
} ) ;
}
} , { "./is" : 10 } ] , 8 : [ function ( require , module , exports ) {
2016-05-18 23:12:36 -04:00
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var $document = $ ( document ) ;
var $window = $ ( window ) ;
var $html = $ ( document . documentElement ) ;
var $body = $ ( document . body ) ;
2016-04-04 21:31:15 -04:00
2016-05-18 23:12:36 -04:00
exports . $document = $document ;
exports . $window = $window ;
exports . $html = $html ;
exports . $body = $body ;
2016-05-19 13:37:19 -04:00
} , { } ] , 9 : [ function ( require , module , exports ) {
2016-05-18 23:12:36 -04:00
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = function ( ) {
( 0 , _svg2 . default ) ( ) ;
} ;
var _svg = require ( '../global/svg' ) ;
var _svg2 = _interopRequireDefault ( _svg ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
2016-04-04 21:31:15 -04:00
2016-05-19 13:37:19 -04:00
} , { "../global/svg" : 2 } ] , 10 : [ function ( require , module , exports ) {
2016-05-18 23:58:08 -04:00
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
2016-05-19 13:37:19 -04:00
var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol ? "symbol" : typeof obj ; } ;
exports . isArray = isArray ;
exports . isArrayLike = isArrayLike ;
exports . isEqual = isEqual ;
exports . isNumeric = isNumeric ;
exports . isObject = isObject ;
exports . isFunction = isFunction ;
var toString = Object . prototype . toString ,
arrayLikePattern = /^\[object (?:Array|FileList)\]$/ ;
// thanks, http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
function isArray ( thing ) {
return toString . call ( thing ) === '[object Array]' ;
}
function isArrayLike ( obj ) {
return arrayLikePattern . test ( toString . call ( obj ) ) ;
}
function isEqual ( a , b ) {
if ( a === null && b === null ) {
return true ;
}
if ( ( typeof a === 'undefined' ? 'undefined' : _typeof ( a ) ) === 'object' || ( typeof b === 'undefined' ? 'undefined' : _typeof ( b ) ) === 'object' ) {
return false ;
}
return a === b ;
}
// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
function isNumeric ( thing ) {
return ! isNaN ( parseFloat ( thing ) ) && isFinite ( thing ) ;
}
function isObject ( thing ) {
return thing && toString . call ( thing ) === '[object Object]' ;
}
function isFunction ( thing ) {
var getType = { } ;
return thing && getType . toString . call ( thing ) === '[object Function]' ;
}
} , { } ] , 11 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . visibilityApi = undefined ;
var _is = require ( './is' ) ;
var _array = require ( './array' ) ;
var _environment = require ( './environment' ) ;
2016-05-18 23:58:08 -04:00
var CALLBACKS = {
hidden : [ ] ,
visible : [ ]
2016-05-19 13:37:19 -04:00
} ; /* jshint esnext: true */
var ACTIONS = [ 'addCallback' , 'removeCallback' ] ;
var STATES = [ 'visible' , 'hidden' ] ;
var PREFIX = 'v-' ;
var UUID = 0 ;
2016-05-18 23:58:08 -04:00
// Main event
_environment . $document . on ( 'visibilitychange' , function ( event ) {
if ( document . hidden ) {
onDocumentChange ( 'hidden' ) ;
} else {
onDocumentChange ( 'visible' ) ;
}
} ) ;
2016-05-19 13:37:19 -04:00
/ * *
* Add a callback
* @ param { string } state
* @ param { function } callback
* @ return { string } ident
* /
function addCallback ( state , options ) {
var callback = options . callback || '' ;
if ( ! ( 0 , _is . isFunction ) ( callback ) ) {
console . warn ( 'Callback is not a function' ) ;
return false ;
}
var ident = PREFIX + UUID ++ ;
CALLBACKS [ state ] . push ( {
ident : ident ,
callback : callback
} ) ;
return ident ;
2016-05-18 23:58:08 -04:00
}
2016-05-19 13:37:19 -04:00
/ * *
* Remove a callback
* @ param { string } state Visible or hidden
* @ param { string } ident Unique identifier
* @ return { boolean } If operation was a success
* /
function removeCallback ( state , options ) {
var ident = options . ident || '' ;
if ( typeof ident === 'undefined' || ident === '' ) {
console . warn ( 'Need ident to remove callback' ) ;
return false ;
}
var index = ( 0 , _array . findByKeyValue ) ( CALLBACKS [ state ] , 'ident' , ident ) [ 0 ] ;
// console.log(ident)
// console.log(CALLBACKS[state])
if ( typeof index !== 'undefined' ) {
( 0 , _array . removeFromArray ) ( CALLBACKS [ state ] , index ) ;
return true ;
} else {
console . warn ( 'Callback could not be found' ) ;
return false ;
}
2016-05-18 23:58:08 -04:00
}
2016-05-19 13:37:19 -04:00
/ * *
* When document state changes , trigger callbacks
* @ param { string } state Visible or hidden
* /
2016-05-18 23:58:08 -04:00
function onDocumentChange ( state ) {
2016-05-19 13:37:19 -04:00
var callbackArray = CALLBACKS [ state ] ;
2016-05-18 23:58:08 -04:00
var i = 0 ;
2016-05-19 13:37:19 -04:00
var len = callbackArray . length ;
2016-05-18 23:58:08 -04:00
for ( ; i < len ; i ++ ) {
2016-05-19 13:37:19 -04:00
callbackArray [ i ] . callback ( ) ;
2016-05-18 23:58:08 -04:00
}
}
2016-05-19 13:37:19 -04:00
/ * *
* Public facing API for adding and removing callbacks
* @ param { object } options Options
* @ return { boolean | integer } Unique identifier for the callback or boolean indicating success or failure
* /
function visibilityApi ( options ) {
var action = options . action || '' ;
var state = options . state || '' ;
var ret = void 0 ;
// Type and value checking
if ( ! ( 0 , _array . arrayContains ) ( ACTIONS , action ) ) {
console . warn ( 'Action does not exist' ) ;
return false ;
}
if ( ! ( 0 , _array . arrayContains ) ( STATES , state ) ) {
console . warn ( 'State does not exist' ) ;
return false ;
}
// @todo Magic call function pls
if ( action === 'addCallback' ) {
ret = addCallback ( state , options ) ;
} else if ( action === 'removeCallback' ) {
ret = removeCallback ( state , options ) ;
}
return ret ;
}
exports . visibilityApi = visibilityApi ;
2016-05-18 23:58:08 -04:00
2016-05-19 13:37:19 -04:00
} , { "./array" : 7 , "./environment" : 8 , "./is" : 10 } ] } , { } , [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ] )
2016-07-14 14:41:30 -04:00
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJhc3NldHMvc2NyaXB0cy9BcHAuanMiLCJhc3NldHMvc2NyaXB0cy9nbG9iYWwvc3ZnLmpzIiwiYXNzZXRzL3NjcmlwdHMvbW9kdWxlcy5qcyIsImFzc2V0cy9zY3JpcHRzL21vZHVsZXMvQWJzdHJhY3RNb2R1bGUuanMiLCJhc3NldHMvc2NyaXB0cy9tb2R1bGVzL0J1dHRvbi5qcyIsImFzc2V0cy9zY3JpcHRzL21vZHVsZXMvVGl0bGUuanMiLCJhc3NldHMvc2NyaXB0cy91dGlscy9hcnJheS5qcyIsImFzc2V0cy9zY3JpcHRzL3V0aWxzL2Vudmlyb25tZW50LmpzIiwiYXNzZXRzL3NjcmlwdHMvdXRpbHMvZ2xvY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