lunedì 12 novembre 2012
Bye Bye IE8 !
Small news, well maybe not too small :-)
I decided to abandon the compatibility with IE8, while for the moment remains valid compatibility with IE9.
Stay tuned !
giovedì 8 novembre 2012
Fujon on GitHub !
Hello everyone!
Did you miss me? The project "Fujon" is going on ... do not despair! Things are a bit 'slow but step by step framework evolves! Just to not disprove me, Fujon was uploaded on github ... oh yeah! I leave you a link to the project:
Skullab/fujon
Stay tuned!
Stay tuned!
venerdì 18 novembre 2011
The code is rewritten...
Hey guys !
The framework has been a major change and needed a better organization...
but do not worry, have a good 30% from the first release.
has been integrated object "Element" in the core package with integration to different listeners, and this was made possible by the introduction of the class interface! Oh yeah, of course, that's right, you can write Java-style interfaces, with the obligation to override methods declared!
When I arrived at a generous 50% will be released the first alpha version, so stay tuned!
venerdì 22 luglio 2011
Declare a Class
Hi everyone!
Today I post a new feature of the framework, the Class object.
With this feature, you can create javascript objects like java-style.
Let's take a look at the code:
supported browser : Firefox,Google Chrome,Opera
Well, now we see how to create a class in JavaScript, using the Class object and "extending" a second class with the first set!
Ok that's all folk today !
Next time I will speak of the forced-typing in javascript
Stay tuned!
Today I post a new feature of the framework, the Class object.
With this feature, you can create javascript objects like java-style.
Let's take a look at the code:
supported browser : Firefox,Google Chrome,Opera
/** Primitive **/ fujon.core.Primitive = function(){ return function(){} ; } fujon.core.Primitive.prototype = { constructor: fujon.core.Primitive } /** Class **/ fujon.core.Class = function(object){ if(object instanceof Object){ var primitive = new fujon.core.Primitive() ; for(var property in object){ var tag_property = property.split('$'); if(tag_property.length > 1){ if(tag_property[0] == 'static'){ primitive[tag_property[1]] = object[property] ; } }else{ if(property == 'constructor'){ primitive = object.constructor primitive.prototype = { constructor: primitive } primitive.toString = function(){return '[object Class]';}; }else if(property == 'extend'){ primitive.super = {} for(var extend_property in object.extend){ if(extend_property != 'constructor'){ primitive.prototype[extend_property] = object.extend[extend_property] ; } primitive.super[extend_property] = object.extend[extend_property] ; } }else{ primitive.prototype[property] = object[property]; } if(property == 'toString'){primitive.toString = object[property];} } } return primitive ; } } fujon.core.Class.prototype = { constructor: fujon.core.Class, super:{}, toString: function(){ if(this.name){ return this.name ; }else return '[object Class]'; } }
Well, now we see how to create a class in JavaScript, using the Class object and "extending" a second class with the first set!
var Class = fujon.core.Class ; Point = new Class({ constructor:function(x,y){ this.x = x ; this.y = y ; }, set:function(what,value){ switch(what){ case 'x' : this.x = value ; break; case 'y' : this.y = value ; break; } }, get:function(what){ switch(what){ case 'x' : return this.x ; case 'y' : return this.y ; } }, toString:function(){return '[object Point]';} }); Point3 = new Class({ constructor:function(x,y,z){ // Call the super constructor ! Point3.super.constructor(x,y); this.z = z ; }, // Extend feature ! // it's important that the statement "extend" is declared after the constructor extend: new Point(), // Override ! set:function(what,value){ if(what == "z"){ this.z = value ; }else{ Point3.super.set(what,value); } }, // Override again ! get:function(what){ if(what == "z"){ return this.z ; }else { return Point3.super.get(what); } }, toString:function(){return "[object Point3]";} }); // Create a new Point3 object ! var p = new Point3(1,2,3); // and try to see the three values alert(p.get("x")); alert(p.get("y")); alert(p.get("z"));
Ok that's all folk today !
Next time I will speak of the forced-typing in javascript
Stay tuned!
domenica 12 dicembre 2010
Implementing GeoLocation...
Another part of framework, this time the geoTools library.
Continue the development of the framework, and this time I reflected on the object "geolocation", which today is supported by all browsers, new generation, with some reservations, to be honest, at the Safari (PC version).
Despite the problem, the geolocation functions are very well, so why not incorporate a map for the visualization of geographic coordinates?
And so the framework decided to incorporate an open source library called OpenLayers. And this is the result!
Continue the development of the framework, and this time I reflected on the object "geolocation", which today is supported by all browsers, new generation, with some reservations, to be honest, at the Safari (PC version).
Despite the problem, the geolocation functions are very well, so why not incorporate a map for the visualization of geographic coordinates?
And so the framework decided to incorporate an open source library called OpenLayers. And this is the result!
// Fujon library reference var geo = fujon.geoTools ; // Create a map with OpenStreetMap var map = geo.easyMaps.createMap('myMap'); // Set a loader widget var loader = new loadBox(map.element) ; loader.show() ; // callback function on success position obtained geo.successCallback.set( function(position){ map.position = position ; //map.zoom = 5 ; loader.hide(); map.show(); } ) // callback function on error geo.errorCallback.set( function(error){ loader.hide(); alert('error number : '+error.code); } ) // Geo position request geo.requestPosition();
lunedì 6 dicembre 2010
The RUNNABLE interface
And here is a part of the Multi-Threading library code
As in Java, I tried to reproduce the concept of the interface "runnable".In this case it's an object, a singleton pattern to be exact.The function of this object is to pave the way for the thread.It consists of three methods available:
As in Java, I tried to reproduce the concept of the interface "runnable".In this case it's an object, a singleton pattern to be exact.The function of this object is to pave the way for the thread.It consists of three methods available:
- set ()
- resume ()
- argumets ()
var RUNNABLE = new function(){ var _this = this ; var runner = null ; var args = [] ; // Set function this.set = function(func){ // func is a function reference without arguments if(typeof(func) == 'function'){ runner = func ; // func is a function with arguments passed like a string: 'example(arg1,arg2)' }else if(typeof(func) == 'string'){ // Operations on string func = func.replace('(',' ') ; func = func.replace(')',''); var ref = func.split(' ')[0] ; func = func.replace(ref,''); args = func.split(','); // Evaluate a function try{runner = eval(ref); }catch(e){throw ERROR.RUNNABLE.unset} // Throw exception if unset }else throw ERROR.RUNNABLE.unset ; // Return a RUNNABLE object return _this ; }; // Resume function // Returns a runner object that contains a runnable function this.resume = function(){ if(runner != null){ return runner ; // Throw exception if runner is null }else throw ERROR.RUNNABLE.resume ; } // Returns always arguments associated to the function even if empty this.arguments = function(){ return args ; } }
domenica 5 dicembre 2010
Yield or not to yield
One of the features of JavaScript 1.7, without a doubt the most interesting, is the introduction of the generators. As generators of the Python language, with version 1.7, introduces the javascript keyword "yield" and methods "next ()" and "send ()" just like in Python!
If you want to see the documentation about Python generators here is a link
Now, with such an instrument to create dynamic loops and iterators, you might well think about creating a javascript library to implement multi-threading ...Said and done! Neil Mix has already designed and created the script to do this!Unfortunately, the javascript version 1.7 is only supported by Mozilla Firefox, no other browser is currently available for this release. Then inspiration strikes, I decided to make this cross-browser, and ta-dan! the multi-threading is now available on all platforms.In a few days (time for some changes) will be the first release of the multi-threading library that compose the framework, fujon goes on!Stay tuned!
If you want to see the documentation about Python generators here is a link
Now, with such an instrument to create dynamic loops and iterators, you might well think about creating a javascript library to implement multi-threading ...Said and done! Neil Mix has already designed and created the script to do this!Unfortunately, the javascript version 1.7 is only supported by Mozilla Firefox, no other browser is currently available for this release. Then inspiration strikes, I decided to make this cross-browser, and ta-dan! the multi-threading is now available on all platforms.In a few days (time for some changes) will be the first release of the multi-threading library that compose the framework, fujon goes on!Stay tuned!
Iscriviti a:
Post (Atom)