summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-20 09:16:38 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-20 09:16:38 +0800
commitf5b387f8602b30d47841696cb0165aa88218f42a (patch)
treed5bbdea82c3d4b8b96d035421e7d28dbffd0f6ed
parentfad30f64dd061fb8c98fe64f6596e1785c8babeb (diff)
Rename index to main and move it up to root dir
Also log the downloaded data.
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac2
-rw-r--r--index.html4
-rw-r--r--main.c (renamed from pages/index.c)6
4 files changed, 10 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 8bfd9ed..8909e90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-bin_PROGRAMS = index.js
-index_js_SOURCES = pages/index.c
-index_js_LDFLAGS = -s EXPORTED_RUNTIME_METHODS=[cwrap] \
- -s EXPORTED_FUNCTIONS=[_main,_index_getproducts] \
+bin_PROGRAMS = main.js
+main_js_SOURCES = main.c
+main_js_LDFLAGS = -s EXPORTED_RUNTIME_METHODS=[cwrap] \
+ -s EXPORTED_FUNCTIONS=[_main,_getproducts] \
-s FETCH
diff --git a/configure.ac b/configure.ac
index 8cf2213..ccc0b82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([shopify-frontend-template-html], [0.0], [prabowo@darapsa.org])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/index.html b/index.html
index 80bd3c6..875451e 100644
--- a/index.html
+++ b/index.html
@@ -10,7 +10,7 @@
<script src="https://unpkg.com/@shopify/app-bridge-utils@3"></script>
<script async>
async function getToken() {
- Module.cwrap('index_getproducts', '',
+ Module.cwrap('getproducts', '',
['string', 'string'])(await
window['app-bridge-utils']
.getSessionToken(
@@ -21,6 +21,6 @@
})), '%s');
}
</script>
- <script type="text/javascript" src="%s/js/index.js"></script>
+ <script type="text/javascript" src="%s/js/main.js"></script>
</body>
</html>
diff --git a/pages/index.c b/main.c
index fc165b6..9304259 100644
--- a/pages/index.c
+++ b/main.c
@@ -4,8 +4,8 @@
static void handle_success(emscripten_fetch_t *fetch)
{
- printf("Finished downloading %llu bytes from URL %s.\n",
- fetch->numBytes, fetch->url);
+ printf("Finished downloading %llu bytes of %s from URL %s.\n",
+ fetch->numBytes, fetch->data, fetch->url);
emscripten_fetch_close(fetch);
}
@@ -16,7 +16,7 @@ static void handle_error(emscripten_fetch_t *fetch)
emscripten_fetch_close(fetch);
}
-void index_getproducts(const char *token, const char *app_url)
+void getproducts(const char *token, const char *app_url)
{
emscripten_fetch_attr_t attr;
emscripten_fetch_attr_init(&attr);