<commit_before>'use strict'

utils = require 'utils'

module.exports = (impl) ->
	{bridge} = impl
	{outActions, pushAction, pushItem, pushBoolean, pushInteger, pushFloat, pushString} = bridge

	DATA =
		imageLoadCallback: null

	bridge.listen bridge.inActions.IMAGE_SIZE, (reader) ->
		image = reader.getItem()
		source = reader.getString()
		success = reader.getBoolean()
		width = reader.getFloat()
		height = reader.getFloat()

		if image.source isnt source
			return

		image._impl.imageLoadCallback?.call image, not success,
			source: source
			width: width
			height: height
		return

	DATA: DATA

	createData: impl.utils.createDataCloner 'Item', DATA

	create: (data) ->
		if data.id is 0
			pushAction outActions.CREATE_IMAGE
			data.id = bridge.getId this
<commit_msg>Native setImageSource bug with source verification fixed<commit_after>'use strict'

utils = require 'utils'

module.exports = (impl) ->
	{bridge} = impl
	{outActions, pushAction, pushItem, pushBoolean, pushInteger, pushFloat, pushString} = bridge

	DATA =
		imageLoadCallback: null

	bridge.listen bridge.inActions.IMAGE_SIZE, (reader) ->
		image = reader.getItem()
		source = reader.getString()
		success = reader.getBoolean()
		width = reader.getFloat()
		height = reader.getFloat()

		image._impl.imageLoadCallback?.call image, not success,
			source: source
			width: width
			height: height
		return

	DATA: DATA

	createData: impl.utils.createDataCloner 'Item', DATA

	create: (data) ->
		if data.id is 0
			pushAction outActions.CREATE_IMAGE
			data.id = bridge.getId this

{'fraction_non_alphanumeric': 0.10590500641848524, 'fraction_numerical': 0.0012836970474967907, 'mean_word_length': 4.078175895765472, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6695611', 'n_tokens_mistral': 533, 'n_tokens_neox': 478, 'n_words': 133}