Skip to content

Instantly share code, notes, and snippets.

Last active Feb 7, 2020
What would you like to do?
FlyWeight client
(function() {
function json(response) {
return response.json()
function getData(url) {
fetch(url, {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
.then(function (data) {
myUsers = data;
console.log('Finished fetching data');
function regularData() {
function flyWeightData() {
let myUsers;
document.getElementById('request').addEventListener('click', regularData);
document.getElementById('requestFlyWieght').addEventListener('click', flyWeightData);
<button id="request">Request data</button>
<button id="requestFlyWieght">Request light weight data</button>
<script src="flyWeight.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment