blackberry-webworks/BBX-Framework — Issue #25: Refactor whitelist code to match the functional / moduler design pattern
Author: gtanner
Created: 2011-11-10 22:28:52+00:00
State: open
Labels: TechDebt

Currently the whitelist code is designed in a classical / statefull pattern which isn't the most readable / maintainable code.

Taking insperation from jasimine / Ripple / jQuery I would like us to revisit this module to design it to better fit with the rest of the modules in the system.

As a quick source of inspiration here is how we whitelist injected APIs in Ripple:
https://github.com/blackberry/Ripple-UI/blob/master/lib/ripple/platform/builder.js

Note that we used closured values, passing functions, recursion and method chaining to make a clean API where to build an API we just need to call:

platform.build(phonegap).into(window);

A clean and easy to understand API. We build up a function that uses closured values to make the code when injecting a matter of calling:

if (allowed(obj)) {
//inject
}