StructureJS
0.15.2A class based utility library for building modular and scalable web platform applications. Features opt-in classes and utilities which provide a solid foundation and toolset to build your next project.
A helper class to detect OS and browsers.
_eventDispatcher
EventDispatcher
private
static
A reference to the EventDispatcher object.
_onBreakpointChangeHandler
Any
private
static
TODO: YUIDoc_comment
_styleDeclaration
Any
private
static
A reference to the getComputedStyle method.
_window
Window
private
static
A reference to the browser window object.
debounceDelay
Number
public
static
The delay in milliseconds for the Util.debounce method that dispatches the BaseEvent.RESIZE event to get the your browser breakpoints. See getBreakpoint.
Default: 250
isEnabled
Boolean
public
static
The isEnabled property is used to keep track of the enabled state of listening for Breakpoint changes.
_onBreakpointChange
()
private
static
Dispatches a breakpoint event.
addEventListener
()
public
static
TODO: YUIDoc_comment
browserName
()
String
public
static
dispatchEvent
()
public
static
TODO: YUIDoc_comment
enable
()
public
static
Dispatches a breakpoint event.
getBreakpoint
()
String
public
static
Get the current breakpoint from the style sheets. You must add a body:after property with a specific content in each of your style sheets for this functionality to work.
The string value of the current style sheet.
// For each of your different style sheets add something like below:
// screen_lg.css
body:after {
content: 'screen_lg'; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; position: absolute; clip: rect(0 0 0 0); overflow: hidden;
}
// screen_sm.css
body:after {
content: 'screen_sm'; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; position: absolute; clip: rect(0 0 0 0); overflow: hidden;
}
BrowserUtil.getBreakpoint();
// 'screen_lg'
// Add a listener to get notified when the browser is resized:
BrowserUtil.addEventListener(BaseEvent.RESIZE, this._onBreakpointChange, this);
...
_onBreakpointChange(baseEvent) {
console.log(baseEvent.data);
// 'screen_sm'
}
getBrowser
()
Array.Gets the browser name a user agent.
BrowserUtil.getBrowser();
// ["Chrome", "39.0.2171.99"]
hasBrowserHistory
()
Boolean
public
static
Determines if the browser can you Browser History push states.
BrowserUtil.hasBrowserHistory();
// true
hasLocalStorage
()
Boolean
public
static
Determines if the browser can you Local Storage.
BrowserUtil.hasLocalStorage();
// true
hasSessionStorage
()
Boolean
public
static
Determines if the browser can you Session Storage.
BrowserUtil.hasSessionStorage();
// true
isAndroid
()
Boolean
public
static
Determines if the device OS is Android.
BrowserUtil.isAndroid();
// false
isBlackBerry
()
Boolean
public
static
Determines if the device OS is Android.
BrowserUtil.isBlackBerry();
// false
isIEMobile
()
Boolean
public
static
Determines if the device OS is IE Mobile.
BrowserUtil.isIEMobile();
// false
isIOS
()
Boolean
public
static
isMobile
()
Boolean
public
static
Determines if the it is run on a mobile or desktop device.
BrowserUtil.isMobile();
// false
isOperaMini
()
Boolean
public
static
Determines if the device OS is Opera Mini.
BrowserUtil.isOperaMini();
// false
removeEventListener
()
public
static
TODO: YUIDoc_comment