Skip to main content

Library Architecture

The JavaScript library was structured around a simple rule:

Share what is truly reusable. Keep form-specific behavior isolated.

Repository structure​

A sanitized representation of the project structure:

/
├── loader.js
├── manifest.json
├── forms/
│ ├── FORM_001.js
│ ├── FORM_002.js
│ ├── FORM_003.js
│ └── ...
├── shared/
│ ├── functions.js
│ └── timing.js
└── homepages/
└── Homepage.js

Responsibility by layer​

LayerResponsibility
loader.jsDetect the active Planon context and load the correct scripts
shared/functions.jsReusable utilities shared by multiple forms
shared/timing.jsHelpers for elements that render asynchronously
forms/*.jsForm-specific logic
homepages/*.jsHomepage-specific behavior
manifest.jsonLibrary metadata / registered modules

Why not one giant file?​

A single large JavaScript file would make every form depend on the same implementation surface.

Instead:

                     ┌──────────────────┐
│ shared layer │
└────────┬─────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ FORM_001 │ │ FORM_002 │ │ FORM_003 │
└──────────┘ └──────────┘ └──────────┘

Each form receives shared behavior without losing its own boundary.

Engineering trade-off​

I intentionally avoided turning the shared layer into a large framework.

The shared layer exists for behavior that is genuinely reused. Business-specific logic remains with the form that owns it.

That keeps the library easier to understand and reduces accidental coupling between forms.