This file contains hidden or 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
import {describe, beforeEach, test, expect, jest} from '@jest/globals'; | |
import {v4 as uuidv4} from 'uuid'; | |
import {calculateBucket} from '../ab-testing'; | |
function generateVisitorUuid(): string { | |
return uuidv4().replace(/-/g, ''); | |
} | |
describe('ab-testing', () => { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script src="http://localhost:3001/remoteEntry.js"></script> | |
</head> | |
<body> | |
<div id="root"></div> | |
</body> | |
</html> |
This file contains hidden or 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
module.exports = { | |
// ... | |
plugins: [ | |
new ModuleFederationPlugin({ | |
name: "appshell", | |
library: { type: "var", name: "appshell" }, | |
filename: "remoteEntry.js", | |
remotes: {}, | |
exposes: { |
This file contains hidden or 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
module.exports = { | |
// ... | |
plugins: [ | |
new ModuleFederationPlugin({ | |
name: 'property', | |
library: {type: 'var', name: 'property'}, | |
filename: 'remoteEntry.js', | |
remotes: { | |
appshell: 'appshell' | |
}, |
This file contains hidden or 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
import React from "react"; | |
import { HashRouter } from "react-router-dom"; | |
const AppShell = React.lazy(() => import("appshell/StandardLayout")); | |
import {Photos} from './Photos'; | |
function App() { | |
return ( | |
<HashRouter> |
This file contains hidden or 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
import React from 'react'; | |
import App from './App'; | |
import PropTypes from 'prop-types'; | |
function StandardLayout({title, children}) { | |
return <App title={title}>{children}</App>; | |
} | |
StandardLayout.propTypes = { | |
title: PropTypes.string, |
This file contains hidden or 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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import {HashRouter} from 'react-router-dom'; | |
import {Header} from './Header'; | |
import {Footer} from './Footer'; | |
import './App.less'; | |
function App({children}) { | |
return ( | |
<HashRouter> |
This file contains hidden or 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(){ | |
var basePonyConfig = document.createElement('script'); | |
basePonyConfig.setAttribute('src','https://panzi.github.io/Browser-Ponies/browserponies.js'); | |
basePonyConfig.setAttribute('id','browser-ponies-script'); | |
document.head.appendChild(basePonyConfig); | |
var ponyScript = document.createElement('script'); | |
ponyScript.setAttribute('src','https://panzi.github.io/Browser-Ponies/basecfg.js'); | |
ponyScript.setAttribute('id','browser-ponies-script'); | |
document.head.appendChild(ponyScript); | |
function init(){ |
This file contains hidden or 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
window.$ = $; | |
function $(s) { | |
let c = { | |
'#': 'ById', | |
'.': 'sByClassName', | |
'@': 'sByName', | |
'=': 'sByTagName'}[s[0]]; | |
return document[c?'getElement'+c:'querySelectorAll'](s.slice(1)); | |
} |