Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cart = (spec, my) ->
- init = ->
- if spec
- my.sItemLabel = spec
- else
- my.sItemLabel = "Item"
- iNumItemsOrdered = 0
- iNumItemsLeft = 2
- my = my or {}
- init()
- my.checkItemInventory = ->
- iNumItemsLeft > 0
- that =
- createCart: ->
- console.log "CART. cart created."
- placeOrder: ->
- console.log "CART. placed order for " + iNumItemsOrdered + " " + my.sItemLabel + "s."
- addItemToCart: ->
- if my.checkItemInventory()
- iNumItemsOrdered++
- console.log "CART. " + my.sItemLabel + " added."
- iNumItemsLeft--
- else
- console.log "CART. sorry " + my.sItemLabel + "s all gone!"
- that
- sooperCart = (spec, my) ->
- my = my or {}
- that = cart(spec, my)
- that.addAllItems = ->
- console.log "CART. add ALL " + my.sItemLabel + "."
- that.addItemToCart() while my.checkItemInventory()
- that
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement