Module-documentation

version 1.0.0
module: itsa-event
maintanance: Marco Asbreuk
home
all modules

Custom made events

Custom Made Events are customevents that are defined by Event.defineEvent(). They differ from DOM-events in a way that they have to be defined manually by the programmer; DOM-events are customevents which are created automaticly.

Click on the button to save the profile.

Code-example:

<body>
    <button id="save" class="pure-button pure-button-primary pure-button-bordered">Save profile</button>
</body>
<script src="itsabuild-min.js"></script>
<script>
    var Profile = ITSA.Classes.createClass(null, ITSA.Event.Emitter('PersonalProfile')),
        myProfile = new Profile();

    myProfile.defineEvent('save') // defines "PersonalProfile:save"
             .defaultFn(function(e) {
                 alert('personal profile was saved');
             });

    ITSA.Event.after('tap', function() {
        myProfile.emit('save');
    }, '#save');
</script>
API Docs