Skip to content

Commit

Permalink
Added asynchronous loader support.
Browse files Browse the repository at this point in the history
Support require.js and sea.js
  • Loading branch information
andot committed Apr 18, 2015
1 parent ee2359b commit b4ef72c
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dist/hprose-html5.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions src/AsyncLoader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/

/**********************************************************\
* *
* AsyncLoader.js *
* *
* hprose asynchronous loader for HTML5. *
* *
* LastModified: Apr 19, 2015 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/

(function (global) {
'use strict';
global.hprose = global.hprose || Object.create(null);
if (typeof define === "function") {
if (define.cmd) {
define('hprose', [], global.hprose);
}
else if (define.amd) {
define("hprose", [], function() { return global.hprose; });
}
}
})(this);
14 changes: 14 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require.config({
paths: {
hprose: '../dist/hprose-html5'
}
});

require(['hprose'], function(hprose) {
var client = new hprose.HttpClient("http://www.hprose.com/example/", ["hello"]);
client.hello("World!", function(result) {
alert(result);
}, function(name, err) {
alert(err);
});
});
36 changes: 36 additions & 0 deletions test/require.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4ef72c

Please sign in to comment.