Skip to content

Changed_in_007

Wesley De Groot edited this page Oct 30, 2015 · 12 revisions
            	     _    _____ 
        	        | |  / ____|
    	            | |  | (___  
	            _   | |  \___  \ 
 ______    _   | |__| |  ____) |
|______|  (_)   \____/  |______/ 

Changed in v0.0.7

js-standard-style

Yes, indeed, were using the 'unofficial' JS Standard Code Style (JSSCS)

New

_.noop()

Non-returning function, does nothing.


_().appendTo()

Append a element to...


_.supportTouch()

Does the client support touch (events)?


_().(...)

....


New Pre Defined Variables

_.browser

Browser info

  • (bool) _.browser.ie
  • (bool) _.browser.firefox
  • (bool) _.browser.safari
  • (bool) _.browser.opera
  • (bool) _.browser.edge
  • (bool) _.browser.chrome
  • (string) _.browser.userAgent
  • (bool) _.browser.supportTouch

_.getBrowser

Browser name


Other cool new things!

Supported now!

window.addEventListener('_.jsLoaded', function() {
  window.alert('_.js Loaded! (received)')
});

- Please note that this will only work if you'll use:

<script type='text/javascript' src='https://raw.githubusercontent.com/wesdegroot/_.js/master/latest/_.js' async></script>

async makes the script (non-blocking) and this will give _.js the opportunity to fire a event. Please note: If you make it (non-blocking) you'll need to check if _.js is loaded! This means that for example this will not work if the script is async (non-blocking)

<script type='text/javascript' src='https://raw.githubusercontent.com/wesdegroot/_.js/master/latest/_.js' async></script>

<div class='inner'>Testing</div>

<script type='text/javascript'>
window.addEventListener('_.jsLoaded', function () {
  window.alert('_.js Loaded! (received)')
})

_('.inner').html('Hi!') // Error, _ Undefined!!!
</script>

How it works with Async is:

<script type='text/javascript' src='https://raw.githubusercontent.com/wesdegroot/_.js/master/latest/_.js' async></script>

<div class='inner'>Testing</div>

<script type='text/javascript'>
window.addEventListener('_.jsLoaded', function () {
  window.alert('_.js Loaded! (received)')
  _('.inner').html('Hi!') // Error, _ Undefined!!!
})
</script>
Clone this wiki locally