Using Scriptor - basic example

From Morfikwiki.com

Jump to: navigation, search

Contents

[edit] Introduction

This describes a basic application using Scriptor, which demonstrates method of communicating with server.

[edit] Notes

This tip has been taken directly from Arman's blog, which can be found at: Arman Mirkazemi.

It comes with an project that you can download, study and modify.

-> Download the example here (882kb)

[edit] Background

There are two major parts to this example:

   * the Scriptor Project - UI or the Client (Project 15 placed inside Project16 folder)
   * the AppsBuilder Project - The server (Project 16) 

Minor parts:

   * very little DOM programming - (Project 15)
   * a simple pre-made HTML file - (Project 15) it has a Combobox and a Textedit. When the Combobox value changes it sends a request to the server and writes the response to the TextEdit.
   * custom servers - (Project 16) put in place which effectively cripples the Xapp, so that it can only respond to certain calls. These Custom Servers are examples of what I've talked about in my previous blogs. 

Obviously using the AppsBuilder is my closest bet to getting a server up and running. Nevertheless any server technology out there like the asp.net, php, ruby, java servelets and etc will be just as good for feeding data into the UI which we build with the Scriptor.

The Cross Domain communication is generally not the case for most people but if you're not aware of it you may end up spending a while figuring what's wrong. Essentially it is browser's way of making sure that scripts can only operate within their own domain space. This means that we can only request data from a server which served our UI or servers with sub domains under the same Domain Name as the server that served the UI. So if the UI was served out of www.morfik.com it can communicate with www.morfik.com or it's sub domains such as the labs.morfik.com.

Currently when programming with the Scriptor, it appears to be really low level and not much of the library seems to be available to work with. This is because the browser framework makes certain assumptions about it's server (being an Xapp). These assumptions are minimal and shall be removed in the future. In fact just with a little bit of trickery you should be able to start using the framework just like you would when developing an AppsBuilder project.

[edit] See also

Personal tools