Sandboxes/JavaScript at master · HowProgrammingWorks/Sandboxes
Repository navigation
JavaScript
Directory actions
More options
Directory actions
More options
Latest commit
History
History
View commit history for this file.
JavaScript
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
parent directory.. | |||
| README.md | README.md | ||
| application.js | application.js | ||
| framework.js | framework.js | ||
README.md
Description
Purpose: learn how to create sandboxed context for modues to separate them and minimize cross-modules code coupling, extracting at least two abstraction layers (applied and system) and how to execute applied code in virtual environment, changing its behavior using IoC from system layer.
Files
framework.js- small piece of the framework, just to demonstrate IoCapplication.js- small piece of the application, also for IoC demonstration
How to execute
From the command line, type: node ./framework.js or node framework
Tasks
You may select at least one of the following tasks, make a fork of this repository and implement your solution there. If those tasks are simple for somebody, please see additional tasks below.
-
Add
setTimeoutandsetIntervalto the application context and use them printing something from the timer function using console.log() -
Inject a link to
utillibrary into the application context and make a few calls to its functions from applied code -
Implement the ability to run different applications inside framework, using command line option, e.g.:
node framework <applicationName> -
Wrap or intercept
console.log()call to add more info into console output in the following format:<applicationName> <time> <message> -
Wrap or intercept
console.log()in the sandboxed application logging all console output into a file in the format:<applicationName> <time> <message> -
Give a link to
requirefunction to the application, add call to it and wrap it for logging to a file in the format:<time> <module name> -
Export a hash from
application.jswith multiple functions and variables, print the list with types from framework -
Export a function from
application.jsand print its parameter count and source code from the framework -
Print a list of everything from the application global context (application sandbox) with the data types specified
-
Compare an application sandboxed context keys before application loaded and after, print it from the framework and find a difference (keys added / deleted)
Additional tasks
-
You can combine several tasks (listed above) in your code, implement a more complex example of interaction between framework and application, preparing run-time environment (sandbox) and/or improving CLI (command line interface)
-
Implement a similar example in another programming language
-
Improve and/or optimize Impress Application Server code, specifically everything related to sandboxing, see: /lib/impress.application.js
-
Use IoC and code isolation principles using sandboxed context and/or other similar technique in your projects (any technological stack) to demonstrate its use and the effect of such use