-
-
Save docluv/79770c33702abba325a3d097f0e6cf08 to your computer and use it in GitHub Desktop.
Custom metric for WebPageTest to detect single page application frameworks
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 SPA="none"; | |
if (typeof(app)=="object") SPA = "unknown"; | |
if (window.hasOwnProperty('require')) { | |
if(window.require.hasOwnProperty('defined')){ | |
if(window.require.defined('troopjs-compose/decorator')) SPA = "troop"; | |
if(window.require.defined('flight/lib/component')) SPA = "flight"; | |
} | |
} | |
if (typeof(window.Polymer)=="function") SPA = "polymer"; | |
if (typeof(window.React)=="object") SPA = "react"; | |
if (typeof(window.Vue)=="function") SPA = "vue"; | |
if (typeof(window.aureliaDatabase)=="object") SPA = "aurelia"; | |
if (typeof(window.angular)=="object") SPA = "angular"; | |
if (typeof(window.ko)=="object") SPA = "knockout"; | |
if (typeof(window.Backbone)=="object") SPA = "backbone"; | |
if (typeof(window.ko)=="object" && typeof(window.Backbone)=="object") SPA = "knockback"; | |
if (typeof(window.dojo)=="object") SPA = "dojo"; | |
if (typeof(window.can)=="object") SPA = "can"; | |
if (typeof(window.ampersand)=="object") SPA = "ampersand"; | |
if (window.hasOwnProperty('m')) { | |
if (window.m.hasOwnProperty('render')) { | |
if (typeof(window.m.render)=="function") SPA = "mithril"; | |
} | |
} | |
return SPA; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment