tweaks to readme, and added a bit more functionality to lib

master
DavidOConnor 6 years ago
parent 0b1642e7a1
commit 277693443e

4
.gitignore vendored

@ -2,5 +2,9 @@
**/*.rs.bk
Cargo.lock
# Pycharm
*.iws
workspace.xml
**/pkg/*
**/.wasm

@ -0,0 +1,40 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="NonAsciiCharacters" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="numpy" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E501" />
<option value="E741" />
<option value="E225" />
<option value="E731" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N806" />
</list>
</option>
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="UnterminatedStatementJS" enabled="false" level="WARNING" enabled_by_default="false">
<option name="ignoreSemicolonAtEndOfBlock" value="true" />
</inspection_tool>
</profile>
</component>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CargoProjects">
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
</component>
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (stocks-C47vojof)" project-jdk-type="Python SDK" />
<component name="RustProjectSettings">
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/seed-quickstart.iml" filepath="$PROJECT_DIR$/.idea/seed-quickstart.iml" />
</modules>
</component>
</project>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -10,7 +10,7 @@ crate-type = ["cdylib"]
[dependencies]
seed = "^0.1.0"
wasm-bindgen = "^0.2.28"
wasm-bindgen = "^0.2.29"
web-sys = "^0.3.6"
# For serialization, eg sending requests to a server. Otherwise, not required.

@ -8,4 +8,17 @@ To get started with, clone this repo, and make the following changes:
crate's name
- Make the same replacement in either `build.sh`, or `build.ps1`, depending on your
operating system (`.sh` for Linux, `.ps` for Windows). You may delete the other one
operating system (`.sh` for Linux, `.ps` for Windows). You may delete the other one.
- If you don't have Rust installed, nightly set up, and wasm-bindgen, [Download it](https://www.rust-lang.org/en-US/), and run the following commands:
`rustup update`
`rustup default nightly`
`rustup target add wasm32-unknown-unknown --toolchain nightly`
`cargo +nightly install wasm-bindgen-cli`
- Run `build.sh` or `build.ps1`, then open `index.html` in a web browser.

@ -29,20 +29,21 @@ enum Msg {
fn update(msg: &Msg, model: &Model) -> Model {
match msg {
Msg::Increment => {
Model {val: model.val + 1}
},
Msg::Increment => Model {val: model.val + 1}
}
}
// View
fn main_comp(model: &Model) -> El<Msg> {
div![ "Hello, World" ]
fn view(model: &Model) -> El<Msg> {
button![
vec![simple_ev("click", Msg::Increment)],
format!("Hello, World × {}", model.val)
]
}
#[wasm_bindgen]
pub fn render() {
seed::vdom::run(Model::default(), update, main_comp, "main");
seed::run(Model::default(), update, view, "main");
}
Loading…
Cancel
Save