mirror of
https://github.com/hariroshan/elm-native-library.git
synced 2024-12-04 06:25:25 +03:00
Merge pull request #3 from hariroshan/adding-elements-in-next-animation-frame
Adding elements in next animation frame
This commit is contained in:
commit
0cc7e25034
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "elm-native-js",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Nativescript bindings for elm using custom HTML elements",
|
||||
"keywords": ["elm", "elm-native", "nativescript", "elm mobile"],
|
||||
"main": "index.js",
|
||||
|
@ -57,6 +57,7 @@ let addView: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
|
||||
function(parentElement, thisElement) {
|
||||
if (parentElement.data == null) return
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const children = Array.from(parentElement.children)
|
||||
const hasActionBar = children.some(x => x.tagName.toLowerCase() === "ns-action-bar")
|
||||
const index = children.indexOf(thisElement)
|
||||
@ -122,6 +123,7 @@ let addView: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
|
||||
}
|
||||
|
||||
return (parentElement.data.content = thisElement.data)
|
||||
})
|
||||
}
|
||||
`)
|
||||
|
||||
@ -129,9 +131,11 @@ let addFormattedText: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
|
||||
function(parentElement, thisElement) {
|
||||
if (parentElement.data == null) return
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const children = Array.from(parentElement.children)
|
||||
const index = children.indexOf(thisElement)
|
||||
parentElement.data.formattedText = thisElement.data
|
||||
})
|
||||
}
|
||||
`)
|
||||
|
||||
@ -139,9 +143,11 @@ let addSpan: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
|
||||
function(parentElement, thisElement) {
|
||||
if (parentElement.data == null) return
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const children = Array.from(parentElement.children)
|
||||
const index = children.indexOf(thisElement)
|
||||
parentElement.data.spans.push(thisElement.data)
|
||||
})
|
||||
}
|
||||
`)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user