Event driven sandbox implementation with permission management for modular javascript architecture