This file contains 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
var simulateEvent = function(selector, evt) { | |
var fireOnThis = document.querySelector(selector); | |
if (document.createEvent) { | |
var evObj = document.createEvent('MouseEvents'); | |
evObj.initEvent(evt, true, false); | |
fireOnThis.dispatchEvent(evObj); | |
} else if (document.createEventObject) { | |
var evObj = document.createEventObject(); |
This file contains 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
/** | |
* Get object property if it exist. | |
* @param {string} propStr - property of object with any level of nesting. 'person.address.home.floor' | |
* @returns {*} needed property | |
*/ | |
function getPropIfExist(propStr){ | |
var props = propStr.split('.'); | |
var lastIndex = props.length - 1; | |
var i = 0; |
This file contains 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
/** | |
* Pause application loading, save references to Angular core, then run application. | |
* Reshetniak Denis 26.01.2015 | |
*/ | |
;(function saveAngularCore(){ | |
//there is iframe which doesn't have angular, so we need to break execution in this case | |
if (window.top !== window){ return false } |
This file contains 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
/** | |
* Get object property if it exist. | |
* @param {string} propStr - property of object with any level of nesting. 'person.address.home.floor' | |
* @returns {*} needed property | |
*/ | |
function getPropIfExist(propStr){ | |
var props = propStr.split('.'); | |
var numOfProps = props.length; |
This file contains 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
var EVENT_NAME = 'beforeBootstrap'; | |
pauseBootstrap(); | |
// track event after application configuration was registered; | |
// it means all modules parts was registered, but compile phase was not started | |
window.addEventListener('DOMContentLoaded', function(){ | |
setTimeout(function(){ | |
// TODO: add comments |
This file contains 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
/** | |
* Q.allSettled behaviour implementation with native Promises | |
* Can be useful if you don't want to stop sequence after rejection | |
* @param {Array} promises - Array of promises | |
* @returns {Array} Results of each promise | |
*/ | |
const allSettled = promises => { | |
// Wrap each promise from array with promise which resolves in both cases, either resolved of rejected | |
const wrap = promise => { |
This file contains 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
/** | |
* Q.delay behaviour implementation with native Promises | |
* @param ms - delay in milliseconds | |
* @returns {Promise} with the same result as original promise but will only be | |
* resolved or rejected after at least ms milliseconds | |
*/ | |
Promise.prototype.delay = function(ms){ | |
// Save original promise | |
const promiseToDelay = this; |
This file contains 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
var async = makeGenerator => (...args) => { | |
const generator = makeGenerator.apply(this, args); | |
const handle = result => { | |
console.log('result from consumer: ', result); | |
if (result.done){ | |
return Promise.resolve( result.value ) | |
} | |
This file contains 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* generatorMaker(){ | |
var a = yield 10; | |
var b = yield 20; | |
return a + b; | |
} | |
var generator = generatorMaker(); | |
console.log( generator.next() ); | |
// 1) return right side of yield ( 10 ) |
This file contains 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
// https://www.edge1s.com/uploads/set_resources_2/6662f1e8900008d8258d107ac1c7d0a9_bg_effect.js | |
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1) |
OlderNewer