[Dev] jaggery 2 status update
jaggery vm.js was implemeted.this class is responsible to compile and load script to the current scope Script can be compiled save and run later or can be compiled in this context and also can compile and run in a new global context. main functions in vm.js is * runInThisContext(fileName, content) * runInNewContext(fileName, content) * compileScript(fileName, content) * runScript(compiledScript, args) * isContext(). *Arguments* # fileName scipt filename which content is going to load # content content of a javascript file as a string # compileScript return value from compiledScript method will be a Script Function.if you execute Object.prototype.toString.call(compileScript), output will be '[Object Function]' *examples* var k = vm.runInNewContext('buddhi.js', 'function(sandbox){ sandbox.count += 1; sandbox.name = kitty};'); var sandbox = { animal: cat,count: 2} k(sandbox); print(sandbox.count); output - 3; in runInThisContext and runInNewContext functions, if u do as above(set function as a content ) you will get a scriptfunction as a return you can execute that function as above if u do as follow.script will be executed.but returns nothing. var k = vm.runInNewContext('buddhi.js', 'var foo = {age:23}; print(foo.age)') output - 23; { print(Object.prototype.toString.call(k))// --- print [Object Undefined] }; *limitations of code* in compileScript function you cannot use second approach because runScript method expecting script function to execute. compileScript and runScript methods will be further developed to bypass this issue -- Thanks Best Regards, *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com lean.enterprise.middleware ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Jaggery 2 status update
we are on process of testing node module load system and changing nashorn script engine environment to work with jaggery 2 -- Thanks Best Regards, *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Jaggery 2 status update
we finished work on module manager and path module, and we are currently working on jaggery 2 utility module. path module contain utilities for handling and transforming file paths.all methods in path module perform only string transformation. this path module and utility modules will become core modules of jaggery 2. new utiltiy functions were added to the jaggery 2 utility module and some functionalities from jaggery 1 utility class, will be added to jaggerry 2 utility module Thanks Best Regards,* * * * *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] Jaggery 2 status update
jaggery 2 module manager is in its final stage.You can use jaggery node manager system to load modules in the way similar to the node.js. for more information how it works.pls refer to node module manager http://nodejs.org/api/modules.html we are working on core modules (file system, path ...) (module manager was purely written in javascript.) -- Thanks Best Regards,* * * * *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] JAGGERY 2 status update
JAGGERY 2 - - - - - - - - - - - jaggery 2 will replace the current rhino script engine with nashorn script engine which is developed by Oracle. nashorn comes with OpenJdk 8 which will be released end of this year. you may find more details here.(Accordnig to the Oracle, nashorn is 5 time faster and 5 times lighter than current rhino script engine.) http://openjdk.java.net/projects/nashorn/ jaggery 2 comes with new package manager system which is similar in node.js. we are following common js specifications. jaggery modules can be downloaded from remote repository.developers can contribute by publishing their modules to the repository. module can be written as single js or jag file or folder as a module. JavaScript file can acquire function and properties of another JavaScript file via require keyword eg: var foo = require('foo'); JavaScript file can expose it's functionality via exports object eg: function foo(){ //do something; }; module.exports = foo; exports.foo = function foo(){ //do something }; jaggery_module folder will use to store modules(user can acquire javascript file outside jaggery_modules folder by giving absolute path eg: /home/someone/Desktop/foo.js) now we are working on jaggery_module manager System. -- Thanks Best Regards,* * * * *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] JAGGERY 2 status update
+1 for the efforts to migrate to Nashhorn... Do we have jaggery2 source in the github repo? On Wed, Oct 2, 2013 at 2:14 PM, Buddhi Mihara bud...@wso2.com wrote: JAGGERY 2 - - - - - - - - - - - jaggery 2 will replace the current rhino script engine with nashorn script engine which is developed by Oracle. nashorn comes with OpenJdk 8 which will be released end of this year. you may find more details here.(Accordnig to the Oracle, nashorn is 5 time faster and 5 times lighter than current rhino script engine.) http://openjdk.java.net/projects/nashorn/ jaggery 2 comes with new package manager system which is similar in node.js. we are following common js specifications. jaggery modules can be downloaded from remote repository.developers can contribute by publishing their modules to the repository. module can be written as single js or jag file or folder as a module. JavaScript file can acquire function and properties of another JavaScript file via require keyword eg: var foo = require('foo'); JavaScript file can expose it's functionality via exports object eg: function foo(){ //do something; }; module.exports = foo; exports.foo = function foo(){ //do something }; jaggery_module folder will use to store modules(user can acquire javascript file outside jaggery_modules folder by giving absolute path eg: /home/someone/Desktop/foo.js) now we are working on jaggery_module manager System. -- Thanks Best Regards,* * * * *Buddhi Nipun Mihara* Software Engineer(intern) WSO2, Inc.:http://wso2.com ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Chan (Dulitha Wijewantha) Software Engineer - Mobile Development WSO2Mobile Lean.Enterprise.Mobileware * ~Email duli...@wso2mobile.com* * ~Mobile +94712112165* * ~Website dulithawijewantha.com * * ~Blog blog.dulithawijewantha.comhttp://dulichan.github.io/chan/ * * ~Twitter @dulitharw https://twitter.com/dulitharw* ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev