event_subscriber.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. // The entry file of your WebAssembly module.
  6. import * as console from "../wamr_app_lib/console"
  7. import * as timer from "../wamr_app_lib/timer"
  8. import * as request from "../wamr_app_lib/request"
  9. export function on_init() : void {
  10. request.subscribe_event("alert/overheat", (req) => {
  11. console.log("### user over heat event handler called:");
  12. console.log("");
  13. console.log(" " + String.UTF8.decode(req.payload) + "\n");
  14. })
  15. }
  16. export function on_destroy() : void {
  17. }
  18. /* Function below are requred by wamr runtime, don't remove or modify them */
  19. export function _on_timer_callback(on_timer_id: i32): void {
  20. timer.on_timer_callback(on_timer_id);
  21. }
  22. export function _on_request(buffer_offset: i32, size: i32): void {
  23. request.on_request(buffer_offset, size);
  24. }
  25. export function _on_response(buffer_offset : i32, size: i32): void {
  26. request.on_response(buffer_offset, size);
  27. }