huwyca / private-fields

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Private fields demo

This demo repo shows 3 different ways of doing "encapsulation" and "private" like fields.

  • flow opaque type with object literal and helper functions to retrieve opaquely hidden field data
  • javascript class with private fields and instance methods to retrieve private field data
  • javascript class with private fields and getters to retrieve private field data

Run the examples locally:

# Compile the examples (typecheck and build)
make

# Run the demo code
make run

About


Languages

Language:JavaScript 82.6%Language:Makefile 17.4%