-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a45fb3d
commit 8ceb301
Showing
5 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function byte_slice_from(string, from) { | ||
return string.slice(from); | ||
} | ||
|
||
export function byte_slice_range(string, from, to) { | ||
return string.slice(from, to); | ||
} | ||
|
||
// https://stackoverflow.com/questions/1966476/how-can-i-process-each-letter-of-text-using-javascript | ||
export function foldGraphemes(string, initial, f) { | ||
let value = initial; | ||
// for (const ch of string) { | ||
// value = f(value, ch); | ||
// } | ||
[...string].forEach((c, i) => { | ||
value = f(value, c, i); | ||
}); | ||
return value; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// TODO fix proper action or add event listener | ||
@external(javascript, "../../plinth_ffi.js", "onClick") | ||
@external(javascript, "../../plinth_ffi.mjs", "onClick") | ||
pub fn on_click(a: fn(String) -> Nil) -> Nil | ||
|
||
@external(javascript, "../../plinth_ffi.js", "onKeyDown") | ||
@external(javascript, "../../plinth_ffi.mjs", "onKeyDown") | ||
pub fn on_keydown(a: fn(String) -> Nil) -> Nil | ||
|
||
@external(javascript, "../../plinth_ffi.js", "onChange") | ||
@external(javascript, "../../plinth_ffi.mjs", "onChange") | ||
pub fn on_change(a: fn(String) -> Nil) -> Nil |
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