Skip to content

Commit

Permalink
torc-tv: Add stack.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Feb 15, 2014
1 parent afe7d7a commit 602741c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions programs/torc-tv/qml/stack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.pragma library

// A simple stack function that mimics/replicates QStack
function Stack() {
var stack = [];

this.clear = function() {
stack = [];
}

this.push = function(element) {
stack.push(element);
};

this.pop = function() {
stack.pop();
};

this.size = function() {
return stack.length;
}

this.top = function() {
if (stack.length > 0) {
return stack[stack.length - 1];
}
return undefined;
}
}

0 comments on commit 602741c

Please sign in to comment.