EzDevInfo.com

stapes

the Javascript MVC microframework that does just enough Stapes.js - the little Javascript framework that does just enough

Inheritance with Stapes.js

I'm trying to make a parent/child link with the JS framework Stapes.js.

Here is my code:

var Parent = Stapes.subclass({
    constructor: function () {
        this.name = 'syl';
    }
});

var Child = Parent.subclass({
    constructor: function (value) {
        this.value = value;

        console.log(this.name); // undefined
    }
});

var child = new Child('a value');

Fiddle here.

How to access to the parent's name property from the child class?


Source: (StackOverflow)

RactiveJS and Stapes model not updating

I am trying to create a filtering for a Stapes object in RactiveJS, but it seem the two way binding is not responding correctly to the update.

I can't work out what is going wrong where as I thought it should just work without any issue, I have created a code example here:

https://jsbin.com/sajeje/4/edit?html,output


Source: (StackOverflow)

Advertisements

How to get AJAX results first and only then run next function

Ok, Here is the situation, I am validating a form. This form has 4 input boxes. 2 validations are done on this form.One validation checks if 3 boxes have some values(doing this with parsely). One box has some code and I have to send this code to server to run a check if the code is valid. Here is How I am doing this:

(pseudo code)

onFormSubmit(){
    var isValid,

    //This is a callback and to get the result of ajax. Ajax function is in different file
    validateCode = function(response){
         isValid = response; // true or false
    };

   isValid = $('#form').parsley('validate');

    //Calling that other file function for ajax result, arguments are passed as object validateCode is function name.
   this.emit('validateCode', {value:promoCodeValue, validate:validateCode});


   // Here in this function, the value of isValid is not updating properly. It is taking the value given by parsley validation.
   doOtherStuff(isValid)

}

So my question is, is there any way with the help of which I could wait for the ajax to complete and then run doOtherStuff function.


Source: (StackOverflow)