javascript - How can i have an access to style object in another function -


how can have access style object in function. i've got part

... onok: function() {            var style = new ckeditor.style({             element: 'p',             styles: {               //some styles             },             spaceflag: 'superflag'           });           editor.applystyle( style );     },     onshow: function(){     // want here spaceflag  } .. 

it looks not have 1 function calls other. instead, both siblings children of parent context. define styles in parent context:

var styleoptions = {         element: 'p',         styles: {           //some styles         },         spaceflag: 'superflag'     }, onok: function() {         var style = new ckeditor.style(styleoptions);         editor.applystyle( style );     },     onshow: function(){         // want here spaceflag         styleoptions.spaceflag     }, ... 

here's separate snippet can run out-of-the-box:

    function logme() {          var styleoptions = {              element: 'p',              styles: {                //some styles              },              spaceflag: 'superflag'          };          console.log(styleoptions.spaceflag);      }      logme();


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -