mergNotify

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
mergNotify <pNotification>, [<pDistributed>]
Associationsmergnotify
Summary

This command registers for a notification to be sent to the calling control (me) whenever it occurs

Introduced8.0
OSios, mac
Platformsdesktop, mobile
Parameters
NameTypeDescription
pNotification

The name of the notification your control should receive. The notification will be sent to the control with a single pUserInfo parameter. This parameter is the result of using the description method of the NSNotification userInfo dictionary. Some notifications do not have any userInfo so this parameter may be empty.

pDistributed

(optional with false default) On OS X this option allows you to use the distributed notification center to recieve notifications from other applications. The parameter has no effect on iOS.

Example
local sTimeResignedActive
constant kMaxTimeResignedBeforeSessionExpires = 300

on openStack
  mergNotify "UIApplicationWillResignActiveNotification"
  mergNotify "UIApplicationDidBecomeActiveNotification"
end openStack

on UIApplicationWillResignActiveNotification pUserInfo
  put the seconds into sTimeResignedActive
end UIApplicationWillResignActiveNotification

on UIApplicationDidBecomeActiveNotification pUserInfo
  if sTimeResignedActive <> "" then
    if the seconds - sTimeResignedActive > kMaxTimeResignedBeforeSessionExpires then
       -- show session expired so login again UI
    end if
  end if
end UIApplicationDidBecomeActiveNotification
Values
NameTypeDescription
return

An id for the notification observer to be used by mergNotifyCancel

Description

The same notification may be registered by multiple controls in your app. If a single control registers for the same notification multiple times it will receive it multiple times.

Tagsexternals