Skip to content

Commit

Permalink
Write JSDoc as it can be parsed by bem-jsd. (close #335)
Browse files Browse the repository at this point in the history
  • Loading branch information
veged committed Jan 23, 2014
1 parent ae9379d commit fa1b9e5
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 16 deletions.
3 changes: 2 additions & 1 deletion desktop.blocks/jquery/__config/jquery__config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @module jquery__config
* @description Configuration for jQuery
*/

modules.define(
Expand All @@ -16,4 +17,4 @@ provide(
}) :
base);

});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* @modules jquery__event_type_pointerclick
* @version 1.0.2
* @author Filatov Dmitry <[email protected]>
* @module jquery
*/

modules.define('jquery', function(provide, $) {
Expand All @@ -26,4 +24,4 @@ var event = $.event.special.pointerclick = {

provide($);

});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @modules jquery__event_type_winresize
* @module jquery
*/

modules.define('jquery', ['ua'], function(provide, ua, $) {
Expand Down Expand Up @@ -27,4 +27,4 @@ if(ua.ie) { // TODO: investigate for which version of IE we need this workaround

provide($);

});
});
7 changes: 6 additions & 1 deletion desktop.blocks/ua/ua.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* @module ua
* @description inspired by http://code.jquery.com/jquery-migrate-1.1.1.js
* @description Detect some user agent features (works like jQuery.browser in jQuery 1.8)
* @see http://code.jquery.com/jquery-migrate-1.1.1.js
*/

modules.define('ua', function(provide) {
Expand Down Expand Up @@ -29,6 +30,10 @@ if(browser.chrome) {
browser.safari = true;
}

/**
* @exports
* @type Object
*/
provide(browser);

});
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/**
* FastClick to jQuery module wrapper.
* @see https://github.com/ftlabs/fastclick
*
* @modules fastclick
*/
modules.define('jquery', function(provide, $) {

/**
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
* FastClick: polyfill to remove click delays on browsers with touch UIs.
*
* @version 0.6.11
* @codingstandard ftlabs-jsv2
* @copyright The Financial Times Limited [All Rights Reserved]
* @license MIT License (see LICENSE.txt)
*/

/**
* @class FastClick
*/

/**
* Instantiate fast-clicking listeners on the specificed layer.
*
Expand Down
15 changes: 12 additions & 3 deletions touch.blocks/ua/__dom/ua__dom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
modules.define('i-bem__dom', ['ua'], function(provide, ua, DOM) {
/**
* @module i-bem__dom
* @description Use ua module for provide user agent features by modifiers and update some on orient change
*/
modules.define('i-bem__dom', ['ua'], function(provide, ua, BEMDOM) {

DOM.decl('ua', {
/**
* @exports i-bem__dom:blocks.ua
* @class ua
* @bem
*/
BEMDOM.decl('ua', {
onSetMod : {
'js' : {
'inited' : function() {
Expand Down Expand Up @@ -36,6 +45,6 @@ DOM.decl('ua', {
},
ua);

provide(DOM);
provide(BEMDOM);

});
101 changes: 100 additions & 1 deletion touch.blocks/ua/ua.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module ua
* @description Detect some user agent features
*/

modules.define('ua', ['jquery'], function(provide, $) {

var win = window,
Expand Down Expand Up @@ -82,25 +87,119 @@ var lastOrient = win.innerWidth > win.innerHeight,
}
});

provide({
provide(/** @exports */{
/**
* User agent
* @type String
*/
ua : ua,

/**
* iOS version
* @type String|undefined
*/
ios : platform.ios,

/**
* Is iPhone
* @type Boolean|undefined
*/
iphone : device.iphone,

/**
* Is iPad
* @type Boolean|undefined
*/
ipad : device.ipad,

/**
* Android version
* @type String|undefined
*/
android : platform.android,

/**
* Bada version
* @type String|undefined
*/
bada : platform.bada,

/**
* Windows Phone version
* @type String|undefined
*/
wp : platform.wp,

/**
* Undetected platform
* @type Boolean|undefined
*/
other : platform.other,

/**
* Opera version
* @type String|undefined
*/
opera : browser.opera,

/**
* Chrome version
* @type String|undefined
*/
chrome : browser.chrome,

/**
* Screen size, one of: large, normal, small
* @type String
*/
screenSize : screen.width > 320? 'large' : screen.width < 320? 'small' : 'normal',

/**
* Device pixel ratio
* @type Number
*/
dpr : win.devicePixelRatio || 1,

/**
* Connection type, one of: wifi, 3g, 2g
* @type String
*/
connection : support.connection,

/**
* Flash version
* @type String|undefined
*/
flash : support.flash,

/**
* Is video supported?
* @type Boolean
*/
video : support.video,

/**
* Is SVG supported?
* @type Boolean
*/
svg : support.svg,

/**
* Viewport width
* @type Number
*/
width : win.innerWidth,

/**
* Viewport height
* @type Number
*/
height : win.innerHeight,

/**
* Is landscape oriented?
* @type Boolean
*/
landscape : lastOrient
});

Expand Down

0 comments on commit fa1b9e5

Please sign in to comment.