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
{ | |
"directory": "public/bower_components" | |
} |
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
{ | |
"directory": "public/bower_components" | |
} |
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
if (!JSON.tryParse) | |
{ | |
JSON.tryParse = function (str) { | |
var successState=1, errorState = 2, result, errorResult, | |
promise = { | |
then: function(successCallback, errorCallback) | |
{ | |
if (this.state === successState) |
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 getModule(moduleName){ | |
console.log('Getting module ' + moduleName); | |
var module = angular.module(moduleName); | |
if (!module) { | |
consoile.error('Module ' + moduleName + ' was not found'); | |
return; | |
} | |
for (var i = 0; i < module.requires.length; i++){ | |
getModule(module.requires[i]); | |
} |
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
if (window.fetch) { | |
const origFetch = fetch; | |
fetch = function(url, options) { | |
if (!options) { | |
options = {}; | |
} | |
// Adding the creadentials option | |
options.credentials = 'include'; |
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
getFragments(url) { | |
if (url.endsWith('/')) { | |
url = url.substring(0, url.length - 1); | |
} | |
if (url.startsWith('/')) { | |
url = url.substring(1); | |
} | |
return url === '/' ? [''] : url.split('/'); |
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
buildRoutesTreeFromFragments(urlFragments, routes) { | |
if (!routes.filter) { | |
throw new Error('Routes should be an array'); | |
} | |
const candidates = routes.filter(route => this.isRouteSuitable(route, urlFragments)); | |
if (candidates.length === 0) { | |
return null; | |
} else if (candidates.length === 1) { | |
return this.buildRouteObject(candidates[0], urlFragments); | |
} else { |
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
isRouteSuitable(route, urlFragments) { | |
const routeURLFragments = this.getFragments(route.path); | |
let result = routeURLFragments.length === urlFragments.length; | |
for (let index = 0; result && index < routeURLFragments.length; index++) { | |
const fragment = routeURLFragments[index]; | |
result = fragment.toLowerCase() === urlFragments[index].toLowerCase() || fragment.startsWith(':'); | |
} | |
return result; | |
} |
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
<a is="self-routing-anchor" href='/path/to/your/target'>Inner content </a> |
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
customElements.define('self-routing-anchor', SelfRoutingAnchor, {extends: 'a'}) |
OlderNewer