This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use wasm_bindgen::JsValue; | |
use web_sys::{window, Url}; | |
#[derive(Debug, Clone, PartialEq)] | |
pub enum Route { | |
Home, | |
Profile { | |
// optional user id | |
// None means "me" | |
user_id: Option<String> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EXAMPLE: | |
// let contract_1 = Contract::new("contract_1", contract_1::msg::InstantiateMsg{}); | |
// let (gas_used, resp) = contract_1.execute(contract_1::msg::ExecuteMsg::Foo{inner_msg_data: "bar"}); | |
// println!("computational gas used: {}", gas); | |
// println!("execution response: {:?}", resp); | |
// | |
// storage actions can also be calculated by estimating as follows: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {AccAddress, Coins, Wallet, CreateTxOptions, MsgStoreCode, MsgInstantiateContract, MsgExecuteContract} from "@terra-money/terra.js"; | |
import {TxResult} from '@terra-dev/wallet-types'; | |
// frequency of polling a transaction to see if it's ready | |
export const DEFAULT_TRANSACTION_INFO_POLL_WAIT:number = 500; //500ms | |
// amount of time to wait before giving up on transaction finishing | |
export const DEFAULT_TRANSACTION_INFO_TIMEOUT:number = 1000 * 60 * 5; // 5 mins | |
// amount of time to wait after uploading, due to localterra weirdness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
until cargo +nightly run --bin parse | |
do | |
echo "crashed with exit code $?. Respawning.." >&2 | |
sleep 1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this will allow connections to local machines local port to be forwarded to remote_ip and remote port | |
socat tcp-listen:[LOCAL_PORT],reuseaddr,fork tcp:[REMOTE_IP]:[REMOTE_PORT] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ComponentSetup": { | |
"scope": "javascript,typescript", | |
"body": [ | |
"import {argsToAttrs} from \"@utils/attributes\";", | |
"import \"@elements/path/to/$2\";", | |
"", | |
"export default {", | |
"\ttitle: \"\"", | |
"}", |
(I asked): what's the reason for async requiring its data to be 'static? I want to say it's because of multithreading, that the async runtime is free to move everything between threads... but that doesn't apply with JS...
Pauan answered:
@dakom nothing to do with multithreading all heap allocated things must be 'static, because they outlive the stack references are always on the stack therefore they cannot outlive the stack so if you put something onto the heap... such as by using Box, or Rc...
- spawn_local will drop its owned data when the future completes. If the future never completes, it's a memory leak.
- same with future_to_promise (holding/dropping the promise won't help)
- ideally a Future should be held so that it can be dropped at any point, thereby avoiding leaks even if the future doesn't complete - e.g. keeping things as proper Rust Futures all the way.
- one-off w/ cancel: https://github.com/Pauan/rust-dominator/tree/master/examples/async
NewerOlder