DrSensor / nusa

incremental runtime that bring both simplicity and power into webdev (buildless, cross-language, data-driven)
MIT License
4 stars 0 forks source link

`strict` and loose mode #59

Open DrSensor opened 1 year ago

DrSensor commented 1 year ago

By default this framework operate on loose mode where __MODE__ === "loose". All scripts that only have strict mode have smaller bundle size and it's organized on strict/ folder. For example,

<script async src="https://esm.run/nusa/strict/render-scope"></script>

will define <render-scope> that only operate on strict mode.

strict mode

loose mode

💡 Hint: traverse binding and binding class field can be implemented at the same time

if (name in instance) {
  desc[name].set = function(value) {
    super[name] = databank[index] = value
  }
}
Object.defineProperties(instance, desc)