Last active
August 29, 2015 14:13
-
-
Save cbonnissent/a8988b8dd37bdad6000b to your computer and use it in GitHub Desktop.
documentController event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ready(function() { | |
var myDocumentCheck = function(document) { return document.family.name === "ANIMAL" && document.view.id === "view1"}; | |
//Ajouter un event au ready | |
window.dcp.document.documentController("addEvent", "ready", { | |
"documentCheck" : myDocumentCheck, | |
"name" : "myEvent.animal" | |
}, function(document) { | |
$(this).documentController("setValue", "animal_title", "toto"); | |
}); | |
// Lister les événements | |
window.dcp.document.documentController("listEvents"); | |
[{ "name" : "myEvent.animal", "documentCheck" : function(...) {...}, "callBack" : function(...) {...}},...] | |
//Supprimer les événements | |
window.dcp.document.documentController("removeEvent", ".animal"); | |
[] | |
//Change | |
window.dcp.document.documentController("addEvent", "change", { | |
"documentCheck" : myDocumentCheck, | |
"name" : "ichange.animal" | |
}, function(document, attribute) { | |
if(attribute.id === "animal_title") { | |
$(this).documentController("showMessage", "You have changed"); | |
} | |
$(this).documentController("showMessage", "I have changed"); | |
}); | |
// Éteindre la lumière derrière soit | |
window.dcp.document.documentController("addEvent", "close", { | |
"documentCheck" : myDocumentCheck, | |
"name" : "close.animal" | |
}, function(document) { | |
$(this).documentController("removeEvent", ".animal"); | |
}); | |
}); |
CircleCode
commented
Jan 18, 2015
- Lors de la suppression d'un ou de plusieurs événements, le retour devrait être les événements supprimés.
- Lors de l'ajout, tu n'indiques pas si ça retourne quelque chose (pour être honnête, je ne sais pas ce que ça peut retourner d'utile, mais je me pose la question…) ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment