Documentation for @nitoku.public/blockApi service🔗


 

Index🔗




Services🔗





Get and set page and block data🔗



get-data🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-data'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

set-data🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'set-data'
  postMsg.message = {'data':'my block data'};
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-page-css🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-page-css'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-inner-width🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-inner-width'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-inner-height🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-inner-height'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-pathname🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-pathname'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

hold-loading-frame🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'hold-loading-frame'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

clear-loading-frame🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'clear-loading-frame'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

allow-same-origin🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'allow-same-origin'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

is-admin-user🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'is-admin-user'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 



Block dialog window🔗



is-dialog🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'is-dialog'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

show-dialog🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'show-dialog'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

close-dialog🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'close-dialog'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

save-and-close-dialog🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'save-and-close-dialog'
  postMsg.message = { 'data' : 'data1data2data3data4data5' };
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 



Block sizing and positioning🔗


set-full-width🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'set-full-width'
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 


set-height🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'set-height'
  postMsg.message = { 'height' : '200'};
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

set-overlay🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'set-overlay';
  postMsg.message = { 'top' : '30', 'bottom' : '20' };
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

clear-overlay🔗


  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'clear-overlay';
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

 

Block shared Data🔗


read-shared🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'read-shared';
  postMsg.message =  { 'id' : 'data-id'};
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-shared-list🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'get-shared-list' 
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

write-shared🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'write-shared' 
  postMsg.message = { 'id' : 'data-id', 'data' : 'data1data2data3data4data5' };
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

delete-shared🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'delete-shared';
  postMsg.message =  { 'id' : 'data-id'} ;
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

 

Block files🔗


get-team-resources-availability🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0";
  postMsg.service = 'get-team-resources-availability';
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-file🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-file'
  postMsg.message = { 'id' : 'data-id' };
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

get-file-list🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'get-file-list' 
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

write-file🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'write-file'
  postMsg.message = { 'id' : 'data-id' , 'blob' : blob};
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 

delete-file🔗

  var postMsg = {};
  postMsg.channel = '@nitoku.public/blockApi';
  postMsg.version = "1.0"
  postMsg.service = 'delete-file'
  postMsg.message = { 'id' : 'data-id'};
  parent.postMessage( fileMsg, "https://www.nitoku.com" ); 



Links🔗



open-link🔗

var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'open-link';
postMsg.message = { 'href' : from.href , 'target' : from.target};
window.parent.postMessage(postMsg,"https://www.nitoku.com");      

Note : If the target is not provided the link will open on same window for nitoku.com links and in a new window for external links.



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);	
}

 

 

 

 

 

 

Nitoku is serviced from cloud infrastructure in USA 🇺🇸, provided from Spain 🇪🇸, developed with ❤️ in Japan 🇯🇵 Tokyo 🗼. Copyright © 2019 Nitoku Europe S.L. Icons by Icon8🔗