Javascript遠程載入架構:JFO Remote Framework 1.0簡介

來源:互聯網
上載者:User

JFO Remote Framework version 1.0

用途:

主要用於遠程指令碼嵌入,有的時候我們可能需要通過在某些應用中嵌入動態指令碼以達到我們想要的資料載入或者一些程式控制,那麼JFOREMOTE可能會符合我們這個要求。
下載:

請複製這個連結,根據您的需要下載所需的版本。https://github.com/41zone/jfo/tree/master/jforemote

著作權:

遵守MIT開源協議,最終著作權歸屬jiuzhang song(Jimmy Song)以及41zone團隊,但是您可以進行修改和傳播。

版本:

這裡提供了兩個版本,jforemote-min.js和jforemote-noajax-min.js。前者擁有規範的ajax功能,其中包括了request和jsonp兩個方法,對於實際的應用中可能jsonp的用途會更大一些,因為常常要應對cross domain的情況,同時如果使用jsonp的方法,那麼就意味著只能通過GET方式進行遠程傳輸。
使用:

第一步. 首先要將jforemote匯入到自己的項目中,實質上就是複製一份代碼,比如我們使用jforemte-min.js,那麼我們需要複製一下這個代碼,這裡您可以參考jforemote-demo.js這裡面的代碼,同時比對jforemote的原始代碼就明白其中的含義,並且就知道如何操作了。 這裡是連結,https://github.com/41zone/jfo/blob/master/jforemote/1.0/jforemote-demo.js

原始代碼如下:

/**

* JFO Remote Framework,Some question for email 'jimmy.song@aliyun.com'

* Declare: This framework of Javascript developed by 41zone team

* License: MIT

*/

(function(j){window.console=window.console||{log:function(a){}};var h= ... )

({}); //在這裡進行添加自己的要處理的邏輯

第二步. 根據需求編寫自己的實際作業碼片段。

添加自己的邏輯後的代碼:

/**

* JFO Remote Framework,Some question for email 'jimmy.song@aliyun.com'

* Declare: This framework of Javascript developed by 41zone team

* License: MIT

*/

(function(j){window.console=window.console||{log:function(a){}};var h= ... )

//注意下面的代碼

({

ready:true,

styles:['http://static.41zone.cc/jfo/css/jforemote.css','http://github.com/jfo/common/css/jfo.css'],

scripts:['http://static.41zone.cc/jfo/js/jfo-min.js',

{url:'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js',conflict:'$',force:true}],

begin:function(remote){console.log('Hello JFO, JFORemote begin to work, there is no any scripts and styles be loaded.');},

success:function(remote){

$(remote.div).html('HELLO JFO, JFO Remote Loaded! We can do something.');

alert(remote.params.name+' = '+remote.query.name);

remote.jsonp('http://dynamic.41zone.cc/jsonp.html?name=jfo',function(data){console.log('result = '+data.name);});

}

});

查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.