|
@@ -0,0 +1,375 @@
|
|
|
+define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
|
|
|
+var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
|
|
|
+var $pkg = $core.addPackage("MiniMVP");
|
|
|
+$pkg.innerEval = function (expr) { return eval(expr); };
|
|
|
+$pkg.imports = ["amber/web/Web", "amber/web/Web-JQuery", "silk/Silk"];
|
|
|
+//>>excludeStart("imports", pragmas.excludeImports);
|
|
|
+$pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/web/Web", "amber/web/Web-JQuery", "silk/Silk"], function () {resolve();}, reject); });
|
|
|
+//>>excludeEnd("imports");
|
|
|
+$pkg.transport = {"type":"amd","amdNamespace":"mini-mvp"};
|
|
|
+
|
|
|
+$core.addClass("MiniMVP", $globals.Object, [], "MiniMVP");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "alert:after:",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["aString", "aNumberOfMilliseconds"],
|
|
|
+source: "alert: aString after: aNumberOfMilliseconds\x0a\x09[ Terminal alert: aString ] valueWithTimeout: aNumberOfMilliseconds",
|
|
|
+referencedClasses: ["Terminal"],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["valueWithTimeout:", "alert:"]
|
|
|
+}, function ($methodClass){ return function (aString,aNumberOfMilliseconds){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($globals.Terminal)._alert_(aString);
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}))._valueWithTimeout_(aNumberOfMilliseconds);
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"alert:after:",{aString:aString,aNumberOfMilliseconds:aNumberOfMilliseconds})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "augmentPage",
|
|
|
+protocol: "starting",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "augmentPage\x0a '#lambda-status' asSilk on: #click bind: [ self doInspectStatus ].\x0a\x09'#console-log' asSilk on: #click bind: [ self doConsoleLog ].\x0a\x09'#timeout-alert' asSilk on: #click bind: [ self alert: 'REMINDER!' after: 5000 ].\x0a\x09'#amber-with' asBrush onClick: [ self doAmberWith ].\x0a\x09'#silk-tag' asSilk on: #click bind: [ self doSilkTAG ].\x0a\x09'#jquery-append' asJQuery click: [ self doJQueryAppend ]",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["on:bind:", "asSilk", "doInspectStatus", "doConsoleLog", "alert:after:", "onClick:", "asBrush", "doAmberWith", "doSilkTAG", "click:", "asJQuery", "doJQueryAppend"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+[$recv(["#lambda-status"._asSilk()
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["asSilk"]=1
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0])._on_bind_("click",(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._doInspectStatus();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}))
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["on:bind:"]=1
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
+[$recv(["#console-log"._asSilk()
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["asSilk"]=2
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0])._on_bind_("click",(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._doConsoleLog();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}))
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["on:bind:"]=2
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
+[$recv(["#timeout-alert"._asSilk()
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["asSilk"]=3
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0])._on_bind_("click",(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._alert_after_("REMINDER!",(5000));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}))
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["on:bind:"]=3
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
+$recv("#amber-with"._asBrush())._onClick_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._doAmberWith();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+$recv("#silk-tag"._asSilk())._on_bind_("click",(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._doSilkTAG();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+$recv("#jquery-append"._asJQuery())._click_((function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._doJQueryAppend();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"augmentPage",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doAmberWith",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doAmberWith\x0a\x09'#output-list' asBrush with: [ :html | html li: 'Amber Web #with: added me!' ]",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["with:", "asBrush", "li:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv("#output-list"._asBrush())._with_((function(html){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv(html)._li_("Amber Web #with: added me!");
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doAmberWith",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doConsoleLog",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doConsoleLog\x0a\x09| greeting target |\x0a\x09greeting := 'Hello'.\x0a\x09target := 'world'.\x0a\x09console log: #{ #greeting -> greeting. #target -> target. #callback -> [ console log: greeting, ', ', target, '!' ] }",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["log:", ","]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+var greeting,target;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+greeting="Hello";
|
|
|
+target="world";
|
|
|
+[$recv(console)._log_($globals.HashedCollection._newFromPairs_(["greeting",greeting,"target",target,"callback",(function(){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv(console)._log_([$recv([$recv($recv(greeting).__comma(", ")).__comma(target)
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx2.sendIdx[","]=2
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0]).__comma("!")
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx2.sendIdx[","]=1
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0]);
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+})]))
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.sendIdx["log:"]=1
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doConsoleLog",{greeting:greeting,target:target})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doInspectStatus",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doInspectStatus\x0a\x09(self getApi: '/status')\x0a\x09\x09then: {#json. #inspect}\x0a\x09\x09catch: [ :err | Terminal alert: err ]",
|
|
|
+referencedClasses: ["Terminal"],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["then:catch:", "getApi:", "alert:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv($self._getApi_("/status"))._then_catch_(["json","inspect"],(function(err){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($globals.Terminal)._alert_(err);
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doInspectStatus",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doJQueryAppend",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doJQueryAppend\x0a\x09'#output-list' asJQuery append: '<li>jQuery append added me!</li>'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["append:", "asJQuery"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv("#output-list"._asJQuery())._append_("<li>jQuery append added me!</li>");
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doJQueryAppend",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "doSilkTAG",
|
|
|
+protocol: "action",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "doSilkTAG\x0a\x09'#output-list' asSilk LI: 'Silk TAG: added me!'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["LI:", "asSilk"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv("#output-list"._asSilk())._LI_("Silk TAG: added me!");
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"doSilkTAG",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "endpoint",
|
|
|
+protocol: "backend",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "endpoint\x0a\x09\x22Return something like 'https://<char mess>.execute-api.eu-central-1.amazonaws.com/default'\x22\x0a\x09^ self error: 'Not yet implemented'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["error:"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $self._error_("Not yet implemented");
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"endpoint",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "getApi:",
|
|
|
+protocol: "backend",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["path"],
|
|
|
+source: "getApi: path\x0a\x09^ Platform fetch: self endpoint, path",
|
|
|
+referencedClasses: ["Platform"],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["fetch:", ",", "endpoint"]
|
|
|
+}, function ($methodClass){ return function (path){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv($globals.Platform)._fetch_($recv($self._endpoint()).__comma(path));
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"getApi:",{path:path})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP);
|
|
|
+
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "start",
|
|
|
+protocol: "starting",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "start\x0a\x09self new augmentPage",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["augmentPage", "new"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+$recv($self._new())._augmentPage();
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"start",{})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.MiniMVP.a$cls);
|
|
|
+
|
|
|
+});
|