Skip to content

Instantly share code, notes, and snippets.

@darwin

darwin/popup.js Secret

Created February 9, 2020 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darwin/a2ce8ee9079f78842f62e9e89dfc6615 to your computer and use it in GitHub Desktop.
Save darwin/a2ce8ee9079f78842f62e9e89dfc6615 to your computer and use it in GitHub Desktop.
var $chromex_sample$popup$$ = {};
function $chromex_sample$popup$core$run_message_loop_BANG_$$() {
var $message_channel$jscomp$1$$ = $background_port$jscomp$inline_1069$$;
console.log("POPUP: starting message loop...");
var $c__21487__auto__$jscomp$9$$ = $cljs$core$async$chan$cljs$0core$0IFn$0_invoke$0arity$03$$(1);
$cljs$core$async$impl$dispatch$run$$(function() {
var $f__21488__auto__$jscomp$27$$ = function() {
function $switch__21128__auto__$jscomp$29$$($state_28831_statearr_28865_28913_statearr_28871_28919$$) {
var $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$ = $state_28831_statearr_28865_28913_statearr_28871_28919$$[1];
if (1 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $state_28831_statearr_28865_28913_statearr_28871_28919$$[2] = null, $state_28831_statearr_28865_28913_statearr_28871_28919$$[1] = 2, $cljs$cst$keyword$recur$$;
}
if (2 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $cljs$core$async$impl$ioc_helpers$take_BANG_$$($state_28831_statearr_28865_28913_statearr_28871_28919$$, 4, $message_channel$jscomp$1$$);
}
if (3 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $cljs$core$async$impl$ioc_helpers$return_chan$$($state_28831_statearr_28865_28913_statearr_28871_28919$$, $state_28831_statearr_28865_28913_statearr_28871_28919$$[2]);
}
if (4 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$ = $state_28831_statearr_28865_28913_statearr_28871_28919$$[2], $state_28831_statearr_28865_28913_statearr_28871_28919$$[7] = $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$, $state_28831_statearr_28865_28913_statearr_28871_28919$$[1] = $cljs$core$truth_$$(null == $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) ? 5 : 6, $cljs$cst$keyword$recur$$;
}
if (5 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $state_28831_statearr_28865_28913_statearr_28871_28919$$[2] = null, $state_28831_statearr_28865_28913_statearr_28871_28919$$[1] = 7, $cljs$cst$keyword$recur$$;
}
if (6 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
return $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$ = $state_28831_statearr_28865_28913_statearr_28871_28919$$[7], console.log("POPUP: got message:", $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$), $state_28831_statearr_28865_28913_statearr_28871_28919$$[8] = null, $state_28831_statearr_28865_28913_statearr_28871_28919$$[2] = null, $state_28831_statearr_28865_28913_statearr_28871_28919$$[1] = 2, $cljs$cst$keyword$recur$$;
}
if (7 === $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$) {
$inst_28818_inst_28818__$1_inst_28825_state_val_28832$$ = $state_28831_statearr_28865_28913_statearr_28871_28919$$[2];
var $inst_28826$$ = console.log("POPUP: leaving message loop");
$state_28831_statearr_28865_28913_statearr_28871_28919$$[9] = $inst_28826$$;
$state_28831_statearr_28865_28913_statearr_28871_28919$$[10] = $inst_28818_inst_28818__$1_inst_28825_state_val_28832$$;
$state_28831_statearr_28865_28913_statearr_28871_28919$$[2] = null;
$state_28831_statearr_28865_28913_statearr_28871_28919$$[1] = 3;
return $cljs$cst$keyword$recur$$;
}
return null;
}
return function() {
function $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____1$$($state_28831$jscomp$1$$) {
for (;;) {
a: {
try {
for (;;) {
var $result__21131__auto__$jscomp$inline_820$$ = $switch__21128__auto__$jscomp$29$$($state_28831$jscomp$1$$);
if (!$cljs$core$keyword_identical_QMARK_$$($result__21131__auto__$jscomp$inline_820$$, $cljs$cst$keyword$recur$$)) {
var $ret_value__21130__auto__$jscomp$27$$ = $result__21131__auto__$jscomp$inline_820$$;
break a;
}
}
} catch ($e28875$jscomp$inline_821$$) {
if ($e28875$jscomp$inline_821$$ instanceof Object) {
$state_28831$jscomp$1$$[5] = $e28875$jscomp$inline_821$$, $cljs$core$async$impl$ioc_helpers$process_exception$$($state_28831$jscomp$1$$), $ret_value__21130__auto__$jscomp$27$$ = $cljs$cst$keyword$recur$$;
} else {
throw $e28875$jscomp$inline_821$$;
}
}
}
if (!$cljs$core$keyword_identical_QMARK_$$($ret_value__21130__auto__$jscomp$27$$, $cljs$cst$keyword$recur$$)) {
return $ret_value__21130__auto__$jscomp$27$$;
}
}
}
function $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____0$$() {
var $statearr_28874$$ = [null, null, null, null, null, null, null, null, null, null, null];
$statearr_28874$$[0] = $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$;
$statearr_28874$$[1] = 1;
return $statearr_28874$$;
}
var $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$ = null;
$chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$ = function($state_28831$jscomp$2$$) {
switch(arguments.length) {
case 0:
return $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____0$$.call(this);
case 1:
return $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____1$$.call(this, $state_28831$jscomp$2$$);
}
throw Error("Invalid arity: " + arguments.length);
};
$chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$.$cljs$core$IFn$_invoke$arity$0$ = $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____0$$;
$chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$.$cljs$core$IFn$_invoke$arity$1$ = $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto____1$$;
return $chromex_sample$popup$core$run_message_loop_BANG__$_state_machine__21129__auto__$$;
}();
}(), $state__21489__auto__$jscomp$27$$ = function() {
var $statearr_28879$$ = $f__21488__auto__$jscomp$27$$.$cljs$core$IFn$_invoke$arity$0$ ? $f__21488__auto__$jscomp$27$$.$cljs$core$IFn$_invoke$arity$0$() : $f__21488__auto__$jscomp$27$$.call(null);
$statearr_28879$$[6] = $c__21487__auto__$jscomp$9$$;
return $statearr_28879$$;
}();
return $cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped$$($state__21489__auto__$jscomp$27$$);
});
return $c__21487__auto__$jscomp$9$$;
}
;if ("undefined" === typeof $chromex_sample$$ || "undefined" === typeof $chromex_sample$popup$$ || "undefined" === typeof $chromex_sample$popup$runonce_1364499943$$) {
var $JSCompiler_inline_result$jscomp$116$$;
console.log("POPUP: init");
var $background_port$jscomp$inline_1069$$ = $chromex$ext$runtime$connect_STAR_$$();
$chromex$protocols$chrome_port$post_message_BANG_$$($background_port$jscomp$inline_1069$$, "hello from POPUP!");
$JSCompiler_inline_result$jscomp$116$$ = $chromex_sample$popup$core$run_message_loop_BANG_$$();
var $chromex_sample$popup$runonce_1364499943$$ = new $cljs$core$PersistentArrayMap$$(null, 2, [$cljs$cst$keyword$value$$, $JSCompiler_inline_result$jscomp$116$$, $cljs$cst$keyword$code$$, "(do (core/init!))"], null);
}
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment