Reuse ACE

Reuse action/condition/expression from other plugin.

Action cr.plugins_.WebStorage.prototype.acts.StoreLocal.call(webstorage_obj, key, value);


Condition
cr.plugins_.WebStorage.prototype.cnds.LocalStorageExists.call(webstorage_obj, key);



Expression 

var fake_ret = {
    value:0,
    set_any: function(value){this.value=value;},
    set_int: function(value){this.value=value;},
    set_float: function(value){this.value=value;}, 
    set_string: function(value) {this.value=value;},
};
cr.plugins_.WebStorage.prototype.exps.LocalValue.call(webstorage_obj, fake_ret, key);
return fake_ret.value



Get instance 
var plugins = this.runtime.types; 
var name, inst; 
for (name in plugins)
{
    inst = plugins[name].instances[0]; 
    if (inst instanceof cr.plugins_.WebStorage.prototype.Instance)
    {
        // get target instance 
    } 
 
 
 
Reference - webstorage extension plugin
   

No comments:

Post a Comment