You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by "华逢义 (JIRA)" <ji...@apache.org> on 2018/06/25 05:50:00 UTC

[jira] [Comment Edited] (WEEX-470) module lost after switch from on Activity to previous Activity

    [ https://issues.apache.org/jira/browse/WEEX-470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16521868#comment-16521868 ] 

华逢义 edited comment on WEEX-470 at 6/25/18 5:49 AM:
---------------------------------------------------

Hi,Hanks Zhang,英文不好抱歉,还是用中文解释下吧
 1.Activity A和 Activity B。在程序里的名字都是ContainerActivity,只不过是两个实例而已。A调用B是又启动了自身一次。

2.在js代码中,我定义了一个全局的变量,叫$xx

3.在$xx中,我定义了一个函数。

$xx.alert = function(abc)

{        var modal = weex.requireModule("modal")        modal.alert(abc) }

4.A进入B,B回到A后,立马执行$xx.alert,会提示:

{color:#ff0000}D/jsLog: [JS Framework] Failed to requireModule("stream"), instance (1) doesn't exist anymore.__ERROR{color}

5.这时候instance(1) doesn't exist anymore.这个1指的是B,但是我现在已经关闭B了,在A中,所以一头雾水。。。

A的id是0,B的id是1

 

值得注意的是,只有定义全局函数中,使用了requireModule才会有这个问题。

非全局变量没有问题

 


was (Author: 931339022@qq.com):
Hi,Hanks Zhang,英文不好抱歉,还是用中文解释下吧
1.Activity A和 Activity B。在程序里的名字都是ContainerActivity,只不过是两个实例而已。A调用B是又启动了自身一次。

2.在js代码中,我定义了一个全局的变量,叫$xx

3.在$xx中,我定义了一个函数。

$xx.alert = function(abc)

{        var modal = weex.requireModule("modal")        modal.alert(abc) }

4.A进入B,B回到A后,立马执行$xx.alert,会提示:

{color:#FF0000}D/jsLog: [JS Framework] Failed to requireModule("stream"), instance (1) doesn't exist anymore.__ERROR{color}

5.这时候instance(1) doesn't exist anymore.这个1指的是B,但是我现在已经关闭B了,在A中,所以一头雾水。。。

A的id是0,B的id是1

 

> module lost after switch from on Activity to previous Activity
> --------------------------------------------------------------
>
>                 Key: WEEX-470
>                 URL: https://issues.apache.org/jira/browse/WEEX-470
>             Project: Weex
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 0.19
>            Reporter: 华逢义
>            Assignee: codefurture
>            Priority: Blocker
>
> Activity A started Activity B.
> B finished and back to A
> After this operation.weex.requireModule(xxx) does not work in Activity A
> the error is as follow:
> {color:#FF0000}D/jsLog: [JS Framework] Failed to requireModule("stream"), instance (4) doesn't exist anymore.__ERROR{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)