File: application/webfan/node_modules/webfan/hps-features-implementation.js

Recommend this page to a friend!
  Classes of Till Wehowski   µ.Flow   application/webfan/node_modules/webfan/hps-features-implementation.js   Download  
File: application/webfan/node_modules/webfan/hps-features-implementation.js
Role: Class source
Content type: text/plain
Description: Class source
Class: µ.Flow
General purpose library of objects
Author: By
Last change: Update hps-features-implementation.js
Date: 6 years ago
Size: 10,224 bytes
 

Contents

Class file image Download
/*! https://github.com/jensarps/AMD-feature/blob/master/examples/targets/dynamic.js*/ // This is the dynamic implementation map containing // tests. /*!# @license webfan (C) Till Wehowski, Webfan.de - All rights reserved. !*/ define(function () { let implementations = {}; let isArray = function (it) { return {}.toString.call(it) == '[object Array]'; }; let isAvailable = function (impl, name) { var isFunction = typeof impl.isAvailable === 'function'; return (isFunction && impl.isAvailable(name)) || (!isFunction && impl.isAvailable); }; let getFeature = function(name) { var featureInfo = implementations[name]; if (isArray(featureInfo)) { for (var i = 0, m = featureInfo.length; i < m; i++) { if (isAvailable(featureInfo[i], name)) { if('undefined'!==typeof featureInfo[i].module){ if('function'===typeof featureInfo[i].module){ return featureInfo[i].module(); } else{ return featureInfo[i].module; } }else if('undefined'!==typeof featureInfo[i].implementation){ if('function'===typeof featureInfo[i].implementation){ return require( featureInfo[i].implementation() ); } else{ return require( featureInfo[i].implementation ); } } return featureInfo[i]; } } } else { return featureInfo; } return false; }; implementations = { // "tellme" only has one implementation, // so we just point to the file that contains // it - but we need to omit the ".js". //tellme: 'tellme/tellme', // "color" has multiple implementations, // so we provide tests for the plugin to decide // what implementation to load. browser : [ { module: function(){ return new Function("return this")(); }, isAvailable: function(){ return !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document); } } ], worker : [ { module: function(){ return new Function("return self")(); }, isAvailable: function(){ return !(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document) && typeof importScripts !== 'undefined'; } } ], // Modernizr Modernizr : [ { implementation:'webfan/bootcache!modernizr', isAvailable: true } ], /* broken todo fetchAPI : [ { implementation:'webfan/bootcache!fetch/frdl.fetch', isAvailable: 'undefined'===typeof global.fetch }, { module: function(){ return global.fetch; }, isAvailable: 'undefined'!==typeof global.fetch } ], */ es6Symbol : [ { implementation:'webfan/bootcache!es6-symbol', isAvailable: 'function'!==typeof Symbol }, { module: function(){ return Symbol; }, isAvailable: 'function'===typeof Symbol } ], shimming : [ { module: function(module){ var shimming = {}; // Polyfill for older browsers. Newer ones already have Object.create. if (!Object.create) { // You don't need to understand this, but Object.create = function(proto) { // this constructor does nothing, function cons() {} // and we assign it a prototype, cons.prototype = proto; // so that the new object has the given proto without any side-effects. return new cons(); }; } function forEach(fn, scope) { for(var i = 0, len = this.length; i < len; ++i) { fn.call(scope, this[i], i, this); } } if ( !Array.prototype.forEach ) { Array.prototype.forEach =forEach; } if ( !NodeList.prototype.forEach ) { NodeList.prototype.forEach = forEach; } shimming.forEach = forEach; shimming.getFeature = getFeature; shimming.config = requirejs.s.contexts._.config; // shimming.fetch = getFeature('fetchAPI'); shimming.customElements = getFeature('customElements'); shimming.Proxy = getFeature('Proxy'); return shimming; }, isAvailable: true }//shims[0] ],//shims // $Compiler->add_library('document-register-element-master/build/document-register-element'); STAGE : [ { module: function() { try{ // require.s.contexts._.config.paths.vm='webfan/vm'; return { name : (!document.querySelector('head').hasAttribute('frdl-stage') ) ? 'DEFAULTS' : document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage'), supported : true, STAGE : 'DEFAULTS' , main : 'webfan/bootcache!frdl', vn : 3 }; }catch(e){ return undefined; } }, isAvailable : (!document.querySelector('head').hasAttribute('frdl-stage') ) || (!!document.querySelector('head').hasAttribute('frdl-stage') && 'DEFAULTS' === document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage') ) }, { module: function() { try{ // require.s.contexts._.config.paths.vm='webfan/vm-frdl'; return { name : document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage'), supported : true, STAGE : 'LEGACY', main : '/api-d/4/js-api/library.js?package=webfan-websites&scripts=,options,', vn : -1 }; }catch(e){ return undefined; } }, isAvailable : !!document.querySelector('head').hasAttribute('frdl-stage') && 'LEGACY' === document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage') }, { module: function() { try{ return { name : document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage'), supported : true, STAGE : 'STABLES' , main : '/api-d/4/js-api/library.js', vn : 0 }; }catch(e){ return undefined; } }, isAvailable : !!document.querySelector('head').hasAttribute('frdl-stage') && 'STABLES' === document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage') }, { module: function() { try{ return { name : document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage'), supported : true, STAGE : 'BETAS' , main : '/cdn/frdl/flow/libraries/flow/dev9.js', vn : 2 }; }catch(e){ return undefined; } }, isAvailable : !!document.querySelector('head').hasAttribute('frdl-stage') && 'BETAS' === document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage') }, { module: function() { try{ // require.s.contexts._.config.paths.vm='webfan/vm'; require.s.contexts._.config.paths['frdl']='frdl8x'; require.s.contexts._.config.paths['libraries/flow/ui']=location.protocol + '//' + 'webfan.de/cdn/frdl/flow/libraries/flow/ui8x'; return { name : document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage'), supported : true, STAGE : 'EXPERIMENTAL' , main : 'webfan/bootcache!frdl', vn : 3 }; }catch(e){ return undefined; } }, isAvailable : !!document.querySelector('head').hasAttribute('frdl-stage') && 'EXPERIMENTAL' === document.querySelector('head[frdl-stage]') .getAttribute('frdl-stage') }, { isAvailable : false } ]//STAGE }; Object.defineProperty(implementations, 'frdlweb', { 'get':function() { return implementations.shimming; } }); // console.dir(getFeature('shimming').getFeature('STAGE')); implementations.vm = [ { implementation : 'webfan/bootcache!webfan/vm', isAvailable : (0 < getFeature('STAGE').vn) ? true : false }, { implementation : 'webfan/bootcache!webfan/vm-frdl', isAvailable : (0 >= getFeature('STAGE').vn) ? true : false } ];//vm implementations.customElements = [ { implementation:'webfan/bootcache!webcomponents-lite', isAvailable: true }//, /* { implementation:'webfan/bootcache!document-register-element-master/build/document-register-element.node', isAvailable: 0===0 || // false=== getFeature('browser') || false===!!document || 'function'!==typeof document.registerElement }, { module: function(){ return customElements; }, isAvailable: 0===1 &&// !!document && 'function'===typeof document.registerElement } */ ]; implementations.Proxy = [ { implementation:'webfan/bootcache!webfan/navigator/shim-proxy', isAvailable: 'undefined'===typeof global.Proxy }, { module: function(){ return global.Proxy; }, isAvailable: 'undefined'!==typeof global.Proxy } ]; return implementations; });