Skip to content

KiaraGrouwstra/proxy-dsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proxies used here are recursive; upon property access they either keep their return value wrapped in a similar Proxy, or don't, based on certain conditions. From the perspective of an FSM each Proxy type could be seen as representing one state. The result: an FSM-based custom DSLs based on ES6 Proxy. This is similar to Tom van Cutsem's principle of Membranes.

Notes: must inject Observable

Esp. great for cleaning ng2 classes with methods like this:

load() {
  if (this.data) {
    return Promise.resolve(this.data);
  }
  return new Promise(resolve => {
    this.http.get('data/data.json').subscribe(res => {
      this.data = this.processData(res.json());
      resolve(this.data);
    });
  });
}

Testing:

npm i -g jasmine-node
npm test
jasmine-node spec/extern-proxy.spec.js

About

Proxy-based FSM-like DSLs for ES6

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published