Create a notification
@constructor
543222
function Notification (payload) {
  this.encoding = "utf8";
  this.payload = {};
  this.compiled = false;

  this.aps = {};
  this.expiry = 0;
  this.priority = 10;

  if (payload) {
    for(let key in payload) {
      if (payload.hasOwnProperty(key)) {
        this[key] = payload[key];
      }
    }
  }
}
1010321
async function getNotifications(config) {
  try {
    const options = {
      method: "GET",
      uri: `${config.obServer}:${config.obPort}/ob/notifications`,
      json: true, // Automatically stringifies the body to JSON
      headers: {
        Authorization: config.apiCredentials,
      },
      // resolveWithFullResponse: true
    };

    return rp(options);
  } catch (err) {
    console.error(`Error in openbazaar.js/getNotifications(): ${err}`);
    console.error(`Error stringified: ${JSON.stringify(err, null, 2)}`);
    throw err;
  }
}
503065
def handle_notification(self, data):
        """"""
        if data.get('method') in self._callbacks:
            self._callbacks.get(data.get('method'))(data.get('params'))
1103083
function show() {
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success';

  return _extends({
    type: _const.RNS_SHOW_NOTIFICATION
  }, opts, {
    uid: opts.uid || Date.now(),
    level: level
  });
}
290890
function signal() {
  var handlers = []

  notify.add    = add
  notify.once   = once
  notify.remove = remove

  return notify


  // ### Function Signal
  //
  // Notifies all handlers of a signal.
  //
  // :: A... -> ()
  function notify() {
    var args = arguments
    handlers.forEach(function(f){ f.apply(null, args) }) }

  // ### Function add
  //
  // Adds a new handler.
  //
  // :: (A... -> B) -> Signal
  function add(f)  {
    if (handlers.every(isnt(f)))  handlers.push(f)
    return notify }

  // ### Function once
  //
  // Adds a new handler that'll be executed at most once.
  //
  // :: (A... -> B) -> Signal
  function once(f) {
    add(function() { f.apply(this, arguments)
                     remove(f) })
    return notify }

  // ### Function remove
  //
  // Removes a handler.
  //
  // :: (A... -> B) -> Signal
  function remove(f) {
    handlers = handlers.filter(isnt(f))
    return notify }
}
202774
function showRegistrationSuccess(){
  $.gritter.add({
    // (string | mandatory) the heading of the notification
    title: window._('ep_email_notifications.titleGritterSubscr'),
    // (string | mandatory) the text inside the notification
    text: window._('ep_email_notifications.msgSubscrSuccess'),
    // (int | optional) the time you want it to be alive for before fading out
    time: 10000,
    // (string | optional) add a class name to the gritter msg
    class_name: "emailNotificationsSubscrResponseGood"
  });
}
520078
private function createMessageObject(string $type, string $message): Notification
    {
        $msg = new Notification();

        $msg->setType($type);
        $msg->setMessage($message);

        $this->handler->add($msg);

        return $msg;
    }
954613
def notify_created(room, event, user):
    
    tpl = get_plugin_template_module('emails/created.txt', chatroom=room, event=event, user=user)
    _send(event, tpl)
1046509
def notification_message(cls, item):
        ''''''
        assert isinstance(item, Notification)
        return cls.encode_payload(cls.request_payload(item, None))
86275
private void notifyCreation(final RepositoryObject object, final Map<String, Object> data) {

		for (final ExternalChangeListener listener : externalChangeListeners) {
			listener.onCreate(object, data);
		}
	}
547890
function notification_event_listener (self, msg) {

	//debug.log('msg = ', msg);

	self._events.emit('$notification', msg);

	//msg = {
	//  name: 'notification',
	//  length: 70,
	//  processId: 1707,
	//  channel: 'tcn',
	//  payload: '"documents",I,"id"=\'0c402f6f-8126-5dc3-a4df-20035bc8304d\''
	//}

	/* Parse notification and emit again correctly */
	let channel = msg && msg.channel || undefined;
	let payload = msg && msg.payload || undefined;
	//debug.log(
	//	'channel = ', channel, '\n',
	//	'payload = ', payload
	//);

	if ( (payload.charAt(0) !== '[') ) {
		self._events.emit(channel, payload);
		return;
	}

	let parsed_payload;
	try {
		parsed_payload = JSON.parse(payload);
	} catch(e) {
		self._events.emit(channel, payload);
		return;
	}
	//debug.log('parsed_payload = ', parsed_payload);
	if (is.array(parsed_payload)) {
		self._events.emit.apply(self._events, [channel].concat(parsed_payload));
	} else {
		self._events.emit.apply(self._events, [channel].concat([parsed_payload]));
	}
}
1285036
def notify(self, level, alert, value, target=None, ntype=None, rule=None):
        

        LOGGER.info('Notify %s:%s:%s:%s', level, alert, value, target or "")

        if ntype is None:
            ntype = alert.source

        for handler in self.handlers.get(level, []):
            handler.notify(level, alert, value, target=target, ntype=ntype, rule=rule)
234107
def notify(options = {})
      @@options = options
      @@options[:entity_class] = self
      @@options[:callbacks] = []
      [:create, :update, :destroy].each {|_method| @@options[:callbacks] << @@options[:actions].delete(_method)}
      @@options[:callbacks].compact!
      open_sender_class
      open_receiver_class
      open_notified_class
      @@notified_flag = true
    end
1155058
def notify_message(self, message, level="info", clear_if_dupl=True,
                       clear_in=CLEAR_NOTIF_BAR_MESSAGE_IN):
        
        with self.notifications_lock:
            if clear_if_dupl and message in self.message_widget_dict.keys():
                logger.debug("notification %r is already displayed", message)
                return
            logger.debug("display notification %r", message)
            widget = urwid.AttrMap(urwid.Text(message), "notif_{}".format(level))
        return self.notify_widget(widget, message=message, clear_in=clear_in)
515388
function Notifications(chrome) {
  this.chrome = chrome;
  
  
  /**
   * Creates and displays a notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.create = sinon.stub();
  
  /**
   * Updates an existing notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.update = sinon.stub();
  
  /**
   * Clears the specified notification.
   * 
   * @param {string} notificationId 
   * @param {function} callback 
   */
  this.clear = sinon.stub();
  
  /**
   * Retrieves all the notifications.
   * 
   * @param {function} callback 
   */
  this.getAll = sinon.stub();
  
  /**
   * Retrieves whether the user has enabled notifications from this app or extension.
   * 
   * @param {function} callback 
   */
  this.getPermissionLevel = sinon.stub();
  
  
  /**
   */
  this.onClosed = new Event();
  
  /**
   */
  this.onClicked = new Event();
  
  /**
   */
  this.onButonClicked = new Event();
  
  /**
   */
  this.onPermissionLevelChanged = new Event();
  
  /**
   */
  this.onShowSettings = new Event();
  
}
104005
def new_style_notification(notify)
      # Given `notifies :restart, "service[foo]"` the target is the
      # `"service[foo]"` string portion.
      target_path = 'args_add_block/args_add/descendant::
        tstring_content[count(ancestor::dyna_symbol) = 0]/@value'
      target = notify.xpath("arg_paren/#{target_path} | #{target_path}").to_s

      # Test the target string against the standard syntax for a new-style
      # notification: `resource_type[resource_name]`.
      match = target.match(/^([^\[]+)\[(.*)\]$/)
      return nil unless match

      # Convert the captured resource type and name to symbols.
      resource_type, resource_name =
        match.captures.tap { |m| m[0] = m[0].to_sym }

      # Normally the `resource_name` will be a simple string. However in the
      # case where it has an embedded sub-expression then we will return the
      # AST to the caller to handle.
      if notify.xpath("descendant::string_embexpr").empty?
        return nil if resource_name.empty?
      else
        resource_name =
          notify.xpath("args_add_block/args_add/string_literal")
      end
      { resource_name: resource_name, resource_type: resource_type }
    end
1264251
private void requestNotificationListener() {
        AndPermission.with(this)
            .notification()
            .listener()
            .rationale(new NotifyListenerRationale())
            .onGranted(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.successfully);
                }
            })
            .onDenied(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.failure);
                }
            })
            .start();
    }