Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
/* jshint esnext: true */
/*
 * App 1
 */
let app1 = {
  
  init: function(obj) {
    this.dataset = obj;
  },
  
  run: function() {
    funca(this.dataset);
  }
  
};
let funca = function(data) {
  data.status = 'started app 1';
};
/*
 * App 2
 */
let app2 = {
  
  init: function(obj) {
    this.dataset = obj;
  },
  
  run: function() {
    funcb(this.dataset);
  }
  
};
let funcb = function(data) {
  data.status = 'started app 2';
};
/* --------- RUNNER --------- */
let dataset = {
  stat: null,
  get status() {return this.stat;},
  set status(val) {this.stat = val;}
};
app1.init(dataset);
app2.init(dataset);
app1.run();
console.log(dataset.status);
app2.run();
console.log(dataset.status);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
xsoulfulxpro
0viewers