LMS

Welcome to the Lobeo Module Server project. Please feel free to submit bugs related to it.
Tasklist

FS#273 - easy method to persist data from javascript

Attached to Project: LMS
Opened by Ferdinand (PaGaisu) - Friday, 09 December 2011, 13:32 GMT
Last edited by Ferdinand (PaGaisu) - Wednesday, 21 December 2011, 14:05 GMT
Task Type Feature Request
Category
Status Closed
Assigned To Ferdinand (PaGaisu)
Operating System All
Severity Low
Priority Normal
Reported Version alpha3
Due in Version alpha4
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Easy method to persist data from javascript:

2 methods: resolve and persist
Accepted data types: string/number/boolean/array

resolve takes the name of variable as single parameter
Example:
resolve('toto');
toto will hold the value coming from the DB or undefined if it's not found

persist takes the name of variable as single parameter
Example:
persist('toto');
The value of toto will be persisted in the DB


////////////////////////////////////////////////
function resolve(variable){
eval(variable+'=35;');
}
function persist(variable){
eval(variable+'=1;');
}
////////////////////////////////////////////////

Mozilla got the very interesting toSource() available on all the object. Why not use this ?
This task depends upon

Closed by  Ferdinand (PaGaisu)
Wednesday, 21 December 2011, 14:05 GMT
Reason for closing:  Implemented
Comment by Ferdinand (PaGaisu) - Tuesday, 13 December 2011, 13:13 GMT
example:

require('com.lobeo.lms.Persistence');

Persistence.resolve('toto');
if(toto==undefined)
toto = 10;

Persistence.persist('toto');
Comment by Ferdinand (PaGaisu) - Monday, 19 December 2011, 14:39 GMT
another example:

require('com.lobeo.lms.Persistence');

//persist
Persistence.persist('toto',function() {print('toto');});

//resolve
var funToto = Persistence.resolve('toto');
funToto();


Loading...