Skip to content

Cannot "apply" #11

@rborn

Description

@rborn

Hi David,

I'm trying to use your lib but it seems I'm not managing to :(
I get a runtime error.

The alloy.js

Alloy.Globals.nano = require("nano");
Alloy.Globals.nano.syntax(/\-\=(.+?)\=\-/gi);

the xml:

    <Label id="fname" class="name" text="-=firstname=-" oneway/>
    <Label id="lname" class="name" text="-=lastname=-" oneway/>

The controller:

var userData =  {
     firstname : '',
     lastname : ''
 }

Alloy.Globals.nano($,userData);

setTimeout(function(){
    userData.firstname = 'moo';

    Alloy.Globals.nano.apply();
    console.error(userData);
}, 2000);

the KBoom:


[ERROR] Exception caught during observer callback: file:PATH_TO_MY_APP.app/nano.js:8313:39
[ERROR] callHook@file:PATH_TO_MY_APP.app/nano.js:8280:13
[ERROR] file:PATH_TO_MY_APP.app/nano.js:8312:31
[ERROR] report_@file:PATH_TO_MY_APP.app/nano.js:2973:29
[ERROR] check_@file:PATH_TO_MY_APP.app/nano.js:3240:19
[ERROR] performMicrotaskCheckpoint@file:PATH_TO_MY_APP.app/nano.js:3034:28
[ERROR] apply@file:PATH_TO_MY_APP.app/nano.js:8378:38
[ERROR] file:PATH_TO_MY_APP.app/alloy/controllers/sections/userProfileWindow.js:433:33

[ERROR] { 
[ERROR]     firstname = moo;
[ERROR]     lastname = "";
[ERROR] } 

Any idea what I'm doing wrong?
The above code tries to simulate an xhr call.

If I put the whole nano part and one apply only in the callback it works, bit as soon as I change the model and call again for apply, it crashes.

Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions