Documentation for @nitoku.public/blockApi service🔗


 

Requests🔗



 

disable-same-origin-request🔗


parent.postMessage(
     "{'service':'@nitoku.public/blockApi', 'request':'disable-same-origin-request'}",
     "https://www.nitoku.com"
);

 

get-data🔗


parent.postMessage(
    "{'service':'@nitoku.public/blockApi','request':'get-data'}",
    "https://www.nitoku.com"
);
        

 

get-page-css🔗

parent.postMessage(
     "{'service':'@nitoku.public/blockApi', 'request':'get-page-css'}",
     "https://www.nitoku.com"
);

 

get-inner-width🔗

parent.postMessage(
     "{'service':'@nitoku.public/blockApi', 'request':'get-inner-width'}",
     "https://www.nitoku.com"
);

 

get-inner-height🔗

parent.postMessage(
     "{'service':'@nitoku.public/blockApi', 'request':'get-inner-height'}",
     "https://www.nitoku.com"
);

 

allow-same-origin🔗

parent.postMessage(
	"{'service':'@nitoku.public/blockApi', 'request':'allow-same-origin'}",
    "https://www.nitoku.com"
);

 

get-pathname🔗

parent.postMessage(
	"{'service':'@nitoku.public/blockApi', 'request':'get-pathname'}",
    "https://www.nitoku.com"
);

 

open-link🔗

 

show-dialog🔗

parent.postMessage(
	"{'service':'@nitoku.public/blockApi', 'request':'show-dialog'}",
    "https://www.nitoku.com"
);

 

close-dialog🔗

parent.postMessage(
	"{'service':'@nitoku.public/blockApi', 'request':'close-dialog'}",
    "https://www.nitoku.com"
);

 

save-and-close-dialog🔗


 

set-full-width🔗


 

parent.postMessage(
	"{'service':'@nitoku.public/blockApi', 'request':'set-full-width'}",
    "https://www.nitoku.com"
);

 

set-height🔗


parent.postMessage(
    "{'service':'@nitoku.public/blockApi','request':{'set-height':'"+ 400 + "'}}",
    "https://www.nitoku.com"
);

 

set-overlay🔗


 

clear-overlay🔗


 

set-data🔗


parent.postMessage(
    "{'service':'@nitoku.public/blockApi','request':{'set-data':'my block data'}}",
    "https://www.nitoku.com"
);

 

hold-loading-frame🔗


 

clear-loading-frame🔗


 

 

Nitoku App's messages handling🔗



if (e.origin !== ("https://www.nitoku.com")){
    console.warn("error on frame origin");
    return;
}
        
if(e.data != null) {
             
  var jdata = JSON.parse(e.data);

       if(jdata.service !== "@nitoku.public/blockApi"){
	           	 return;
       }
          
       if(jdata.response.id === "get-data" ){        
            	console.log(jdata.response.data);	
       }
}
      

 

 

Nitoku App's event messages🔗



data-update🔗


if(jdata.response.id === "data-update" ){        
      console.log(jdata.response.data);	
}

close-dialog-event🔗


This event is received when the user clicks on the close bottom of the block dialog menu. You can capture this event with:

if(jdata.response.id === "close-dialog-event" ){        
      console.log(jdata.response.data);	
}