|
@@ -12,6 +12,96 @@ $core.addClass("BrowserPlatform", $globals.Object, [], "Platform-Browser");
|
|
|
|
|
|
$globals.BrowserPlatform.comment="I am `Platform` service implementation for browser.";
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "fetch:",
|
|
|
+protocol: "public API",
|
|
|
+fn: function (aStringOrObject){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+$recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+throw $early=[$recv(fetch)._value_(aStringOrObject)];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
|
|
|
+
|
|
|
+}),(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._error_("fetch not available.");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"fetch:",{aStringOrObject:aStringOrObject})});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aStringOrObject"],
|
|
|
+source: "fetch: aStringOrObject\x0a\x09self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | ^ fetch value: aStringOrObject ]\x0a\x09\x09ifAbsent: [ self error: 'fetch not available.' ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:", "error:"]
|
|
|
+}),
|
|
|
+$globals.BrowserPlatform);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "fetchUrl:options:",
|
|
|
+protocol: "public API",
|
|
|
+fn: function (aString,anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $early={};
|
|
|
+try {
|
|
|
+$recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+throw $early=[$recv(fetch)._value_value_(aString,anObject)];
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
|
|
|
+
|
|
|
+}),(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $self._error_("fetch not available.");
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+}
|
|
|
+catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"fetchUrl:options:",{aString:aString,anObject:anObject})});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aString", "anObject"],
|
|
|
+source: "fetchUrl: aString options: anObject\x0a\x09self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | ^ fetch value: aString value: anObject ]\x0a\x09\x09ifAbsent: [ self error: 'fetch not available.' ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:value:", "error:"]
|
|
|
+}),
|
|
|
+$globals.BrowserPlatform);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "globals",
|