MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 209 forks source link

notice.notify throwing an error with example code #136

Closed colindean closed 9 years ago

colindean commented 10 years ago

From the API reference:

macgap.notice.notify({
  title: "Notify",
  content: "New Message!",
  sound: false // optional
});

Also tried

macgap.notice.notify({title: "Notify",content: "New Message!"})

Receives:

TypeError: 'undefined' is not an object (evaluating 'macgap.notice.notify')
line: 1
message: "'undefined' is not an object (evaluating 'macgap.notice.notify')"
stack: "eval code↵eval@[native code]↵_evaluateOn↵_evaluateAndWrap↵evaluate"
__proto__: Error
constructor: function TypeError() {
length: 1
name: "TypeError"
prototype: Error
__proto__: function () {
message: ""
name: "TypeError"
toString: function toString() {
length: 0
name: "toString"
__proto__: function () {
__proto__: Error
constructor: function Error() {
message: ""
name: "Error"
toString: function toString() {
__proto__: Object
BelinChung commented 9 years ago

Try it

<script type="text/javascript">
    if (macgap.notice) {
        macgap.notice.notify({title: 'MacGap', content: 'Using native OS X notifications'});
    } else {
        macgap.growl.notify({title: 'MacGap', content: 'Using Growl notifications'});
    }
</script>
jeff-h commented 9 years ago

@BelinChung Are you saying it does work ok, using your code sample?

BelinChung commented 9 years ago

@jeff-h I found the code in https://github.com/MacGapProject/MacGap1/pull/60. And I build my application based on MacGap2, so maybe it running. :)

jeff-h commented 9 years ago

Notify.notify() in MacGap 2 has been deprecated. See the docs at:

http://docs.macgap.com/ref/notify.html and MacGap.notify() at http://docs.macgap.com/ref/macgap.html